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 i.e. 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:
- Message: unknown error: Chrome failed to start: exited abnormally on AWS Cloud9 with Linux 4.9.85-38.58.amzn1.x86_64 x86_64
- 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 with ChromeDriver Chrome and Selenium through Python on VPS