selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities found
时间: 2023-10-26 17:32:40 浏览: 64
这个错误通常是由浏览器版本与Selenium驱动程序不兼容引起的。你可以尝试以下解决方案:
1. 确保你的浏览器和Selenium驱动程序版本匹配。可以在Selenium官网上查看版本兼容性信息。
2. 如果你使用的是Chrome浏览器,请确保你已经下载了与你的Chrome浏览器版本相匹配的ChromeDriver驱动程序。可以在ChromeDriver官网上下载。
3. 检查你的代码中是否有语法错误或逻辑错误。有时候代码错误也会引起这个错误。
4. 如果你正在使用远程浏览器,确保远程浏览器配置正确,并且网络连接正常。
如果以上方法都不能解决问题,你可以尝试升级或降级Selenium和浏览器版本,或者尝试使用其他浏览器来测试。
相关问题
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
selenium.common.exceptions.SessionNotCreatedException: Message: session not created 是一个常见的错误,它通常发生在启动浏览器时,由于浏览器版本与驱动程序版本不匹配导致的。根据你提供的引用内容,你的Chrome浏览器版本是80,但是你下载的ChromeDriver版本是78,因此导致了这个错误。
要解决这个问题,你可以尝试下载最新版本的ChromeDriver来匹配你的Chrome浏览器版本。你可以从ChromeDriver的官方网站 https://sites.google.com/a/chromium.org/chromedriver/ 下载最新版的ChromeDriver。
另外,根据你提供的代码,你已经在导入文件中使用了try-except语句来捕捉并处理SessionNotCreatedException异常。当浏览器启动失败时,你会得到一个输出 "Chrome version unmatch." 的提示,并返回0。这是一个很好的处理方式,确保你能够及时发现和处理浏览器版本不匹配的问题。
selenium.common.exceptions.SessionNotCreatedException: Message: Error: NS_BINDING_ABORTED
根据提供的引用内容,selenium.common.exceptions.SessionNotCreatedException: Message通常是由于ChromeDriver版本与Chrome浏览器版本不兼容导致的。而Error: NS_BINDING_ABORTED通常是由于网络连接问题或浏览器插件问题导致的。
解决selenium.common.exceptions.SessionNotCreatedException: Message的方法是更新ChromeDriver或降级Chrome浏览器版本。可以通过以下步骤更新ChromeDriver:
1. 打开Chrome浏览器,查看版本号。
2. 下载与Chrome浏览器版本兼容的ChromeDriver版本。
3. 将新的ChromeDriver替换旧的ChromeDriver。
解决Error: NS_BINDING_ABORTED的方法是检查网络连接是否正常,或者禁用浏览器插件。如果网络连接正常,可以尝试禁用浏览器插件,然后重新启动浏览器。
```python
# 禁用浏览器插件的Python代码示例
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--disable-extensions')
options.add_argument('--disable-plugins-discovery')
service = Service('/path/to/chromedriver')
driver = webdriver.Chrome(service=service, options=options)
```