org.openqa.selenium.WebDriverException: chrome not reachable - when attempting to start a new session
The error does gives us some hint as follows :
org.openqa.selenium.WebDriverException: chrome not reachable
Which essentially implies that chromedriver
binary is unable to spawn a new Chrome Browser
process.
Your main issue is the version compatibility among the binaries you are using as follows :
- You are using
chromedriver=2.35.528161
(released2018-01-10
) - Release Notes of
chromedriver=2.35
clearly mentions the following :
Supports Chrome v62-64
- You mentioned of using latest Chrome. I suppose it is
chrome=65.x
- You are using
Selenium Version 2.52.0
(released 2016-02-11 11:22:43) [as per the error stack trace within your question
]
So the time gap between the release of Selenium Version 2.52.0
and chromedriver=2.35.528161
is almost 2 Years and are not compatible. Hence ChromeDriver
is unable to spawn the new Chrome Browser
process at times.
Solution
- Keep the
ChromeDriver
atv2.35
level. - Downgrade
Chrome
to stableChrome v64.x
levels. (as per ChromeDriver v2.35 release notes
) - Upgrade
Selenium
to current levelsVersion 3.8.1
. - Execute your
Test
.
Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
Try to download HERE and use this latest chrome driver version:
- https://sites.google.com/chromium.org/driver/
Try this:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
d = webdriver.Chrome('/home/<user>/chromedriver',chrome_options=chrome_options)
d.get('https://www.google.nl/')
WebDriverException: Message: chrome not reachable after long time
Initially I had asked myself the same questions as @GregBurghardt had been asking in the comments till I analyzed the detailed error stack trace.
Yes, there is somehting amazing happening in those steps marked as #do thing that require hours
. Hence, instaed of showing Chrome browser version as chrome=76.0
, chrome=75.0
or chrome=74.0
it shows:
(Session info: chrome=192.168.0.0)
which is pretty much surprising.
It would be almost impossible to analyze the issue until and unless you update us why and how the Chrome version gets changed to such value.
Having said that, possibly your main issue is the incompatibility between the version of the binaries you are using.
- You are using chromedriver=2.36
- Release Notes of chromedriver=2.36 clearly mentions the following :
Supports Chrome v63-65
- Presumably you are using the latest 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.
So there is a clear mismatch between the ChromeDriver v2.36 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 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()
withintearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.
References:
- Python selenium WebDriverException: chrome not reachable while opening ChromeDriver
- selenium.common.exceptions.WebDriverException: Message: chrome not reachable error while using find_element_by_id Selenium with ChromeDriver
- org.openqa.selenium.WebDriverException: chrome not reachable - when attempting to start a new session
Win 10, python 3.8 selenium 3.141 WebDriver error: Message: chrome not reachable
Try to get your correct driver with
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
if you don't have it installed :
pip install webdriver_manager
This package will handle all the manual complications of finding the correct driver.
Related Topics
How to Disable 'X-Frame-Options' Response Header in Spring Security
How to Represent a Range in Java
Why Are Wait() and Notify() Declared in Java's Object Class
Getting Xml Node Text Value with Java Dom
Why Do Constructors in Java Not Have a Return Type
Java Array with More Than 4Gb Elements
Why String.Replaceall() in Java Requires 4 Slashes "\\\\" in Regex to Actually Replace "\"
How to Set an Environment Variable at Runtime from Java
How to Determine the Primitive Type of a Primitive Variable
Javac Error: Class Names Are Only Accepted If Annotation Processing Is Explicitly Requested
Convert Xml to Java Object Using Jaxb (Unmarshal)
Java: Bufferedimage to Byte Array and Back
Why Aren't Integers Cached in Java
String S = New String("Xyz"). How Many Objects Has Been Made After This Line of Code Execute