![](/img/trans.png)
[英]TDD-Django(deploy) Error : selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
[英]selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium
我正在尝试在linux服务器上运行webscraper。 完整错误如下
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-141-generic x86_64)
我曾在stackoverflow上看到过类似的问题,解决方案包括“ --headless”和“ --no-sandbox”参数。 但是,我已经在这样做了。
我可以在本地运行此代码,但是无法在服务器上运行它。
我还检查了一切,一切都是最新的。
ChromeDriver 2.10.267518
selenium 3.141.0
这是发生错误的代码段。
options.add_argument('--headless')
options.add_argument('--no-sandbox')
caps = DesiredCapabilities.CHROME
caps['loggingPrefs'] = {'performance': 'ALL'}
driver = webdriver.Chrome(options=options, desired_capabilities=caps, executable_path='/usr/local/bin/chromedriver')
我也尝试了不使用execute_path选项运行上述代码,但仍然收到相同的错误。
此错误消息...
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.10.267518,platform=Linux 4.4.0-141-generic x86_64)
...暗示ChromeDriver无法启动/产生新的WebBrowser,即Chrome浏览器会话。
您的主要问题是所使用的二进制版本之间的不兼容性 ,如下所示:
支持Chrome v33-36
支持Chrome v71-73
因此, ChromeDriver v2.10和Chrome浏览器v72.0之间存在明显的不匹配
@Test
。 我正在使用将标头值设置为True的配置文件,因此代码试图在浏览器上运行并失败。 这是一个愚蠢的错误,但是无论如何我都会发布解决方案,以防它对某人有所帮助。
我还必须删除下面的行
options.add_argument('--no-sandbox')
并更改此行
options.add_argument('--headless')
至
options.add_argument('headless')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.