Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

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:UsersaliceDesktopchromedriver')
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:UsersaliceDesktopchromedriver')
    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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...