selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: crashed.
时间: 2023-11-17 15:02:33 浏览: 60
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: crashed通常是由于以下原因之一引起的:
1. Chrome浏览器版本与ChromeDriver驱动程序版本不兼容。
2. Chrome浏览器未正确安装或未安装。
3. ChromeDriver驱动程序未正确安装或未安装。
4. Chrome浏览器正在运行,无法启动新的实例。
解决此问题的方法包括:
1. 确保Chrome浏览器和ChromeDriver驱动程序版本兼容。可以在ChromeDriver的官方网站上找到版本兼容性列表。
2. 确保Chrome浏览器已正确安装并在系统路径中。
3. 确保ChromeDriver驱动程序已正确安装并在系统路径中。
4. 关闭所有正在运行的Chrome浏览器实例,然后再次尝试启动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)
```