简体   繁体   中英

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium

I am trying to run a webscraper on a linux server. The full error is below

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)

I have seen similar questions asked on stackoverflow, the solutions are to include the '--headless' and '--no-sandbox' arguments. However, I am already doing this.

I am able run this code locally, however, I am unable to make it work on the server.

I have also checked to see that everything is up to date, and everything is.

ChromeDriver 2.10.267518
selenium     3.141.0

Here is the code snippet where the error occurs.

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')

I have also tried to run the above code without the executable_path option but I still get the same error.

This error message...

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)

...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.10
  • Release Notes of chromedriver=2.10 clearly mentions the following :

Supports Chrome v33-36

  • Possibly you are using the latest chrome=72.0
  • Release Notes of ChromeDriver v2.46 clearly mentions the following :

Supports Chrome v71-73

So there is a clear mismatch between the ChromeDriver v2.10 and the Chrome Browser v72.0


Solution

  • Upgrade ChromeDriver to current ChromeDriver v2.46 level.
  • Keep Chrome version between Chrome v71-73 levels. ( as per ChromeDriver v2.45 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 and install a recent GA and released version of Web Client .
  • Take a System Reboot .
  • Execute your @Test .

I was using a config file that was setting the header value to True, so the code was trying to run with a browser and failing. This was a stupid mistake but I'm posting the solution anyway in case it helps someone.

I also had to remove the line below

options.add_argument('--no-sandbox')

and change this line

options.add_argument('--headless')

to

options.add_argument('headless')

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 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 selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed with ChromeDriver and Selenium in Python selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process error with ChromeDriver Chrome Selenium selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process with ChromeDriver Chrome with Selenium Python WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally error using ChromeDriver Chrome and Selenium Python selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start with Selenium and Chrome on RaspberryPi 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 WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium on debian server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM