简体   繁体   中英

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium on debian server

i try to run the selenium webdriver on a debian server 8.11 and get an error.

Java: java version "1.7.0_221", OpenJDK Runtime Environment (IcedTea 2.6.18)

Webdriver: ChromeDriver (v2.9.248304)

Sourcecode:

from selenium import webdriver
from pyvirtualdisplay import Display

display = Display(visible=0, size=(800, 800))
display.start()
co = webdriver.ChromeOptions()
co.add_argument("--user-data-dir=profile")
browser = webdriver.Chrome('/usr/local/bin/chromedriver', options=co)
browser.get('example.com')
browser.quit()
display.close()

I get this error:

Traceback (most recent call last):
  File "/bin/selenium", line 11, in <module>
    browser = webdriver.Chrome('/usr/local/bin/chromedriver', options=co)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.9.248304,platform=Linux 4.9.0-0.bpo.9-amd64 x86_64)

I try several solutions but nothing works...

This error message...

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.9.248304,platform=Linux 4.9.0-0.bpo.9-amd64 x86_64)

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser ie Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.9
  • Release Notes of chromedriver=2.9 clearly mentions the following :

Supports Chrome v31-34

  • Presumably you are using chrome= 76.0
  • Release Notes of ChromeDriver v76.0 clearly mentions the following :

Supports Chrome version 76

  • Your Selenium Client version is unknown to us.
  • You mentioned about JDK version is 1.7.0_221 which is pretty ancient.

So there is a clear mismatch between the ChromeDriver v2.9 and the Chrome Browser v76.0


Solution

Ensure that:

  • Selenium is upgraded to current levels Version 3.141.59 .
  • ChromeDriver is updated to current ChromeDriver v76.0 level.
  • Chrome is updated to current Chrome Version 76.0 level. (as per ChromeDriver v76.0 release notes )
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client .
  • Take a System Reboot .
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

References

You can find a couple of relevant discussions in:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally error using ChromeDriver Chrome and Selenium Python WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium through Python on VPS WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally using Selenium ChromeDriver and Chrome through WebDriverManager Setup selenium with headless chrome error: WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally Python : Selenium - Message: unknown error: Chrome failed to start: exited abnormally 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. Dockerize Flask Application Unknown error: Chrome failed to start: exited abnormally selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed with ChromeDriver and Selenium in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM