Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python selenium WebDriverException: chrome not reachable while opening ChromeDriver

I am using Selenium Chrome Webdriver to open a webpage in Python 3. I would like to have a function that can open the webpage. I originally had:

driver = webdriver.Chrome(executable_path=r'C:\Users\alice\Desktop\chromedriver')
driver.get('https://reports.blm.gov/report/LR2000/23/Pub-MC-Geo-Index')

I put it in to a function goTo()

def goTo():
    driver = webdriver.Chrome(executable_path=r'C:\Users\alice\Desktop\chromedriver')
    driver.get('https://reports.blm.gov/report/LR2000/23/Pub-MC-Geo-Index')

However, I was unable to do any other action on that page outside of that goTo function. When try I get error:

WebDriverException: chrome not reachable
  (Session info: chrome=65.0.3325.181)
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)

Does anyone knows how can I open the a page properly using a function?

like image 249
Alice Hsieh Avatar asked Apr 11 '18 04:04

Alice Hsieh


1 Answers

The error says it all :

WebDriverException: chrome not reachable
  (Session info: chrome=65.0.3325.181)
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)

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

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

Supports Chrome v62-64

  • You are using chrome=65.0
  • Release Notes of ChromeDriver v2.36 clearly mentions the following :

Supports Chrome v64-66

So there is a clear mismatch between the ChromeDriver version (v2.35) and the Chrome Browser version (v65.0)

Solution

  • Upgrade Selenium to current levels Version 3.11.0.
  • Upgrade ChromeDriver to current ChromeDriver v2.37 level.
  • Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.37 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
  • 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.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
like image 190
undetected Selenium Avatar answered Oct 18 '22 14:10

undetected Selenium