Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python - selenium.common.exceptions.WebDriverException: Message: chrome not reachable error while using find_element_by_id Selenium with ChromeDriver

Here is the html code:

< input class="form-control input-lg input auto-complete" id="ymMsgInput" type="text" placeholder="Type your message ..." autocomplete="off" >

Code:

i = s.find_element_by_id("ymMsgInput");

Python - Selenium Chrome webdriver error:

Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    i = s.find_element_by_id("ymMsgInput");
  File "C:UsersvishnAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdriver
emotewebdriver.py", line 351, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "C:UsersvishnAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdriver
emotewebdriver.py", line 955, in find_element
    'value': value})['value']
  File "C:UsersvishnAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdriver
emotewebdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:UsersvishnAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdriver
emoteerrorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
  (Session info: chrome=65.0.3325.146)
  (Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 10.0.16299 x86_64)
See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

The error says it all :

    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable

This error is observed in case of version compatibility between the binaries which an user uses but definitely this is not your case as you are :

  • Using chromedriver=2.36
  • Using chrome=65.0
  • Selenium version unknown

    Release Notes of chromedriver=2.36 clearly mentions :

    Supports Chrome v65-66

But, since the release of the latest Chromedriver 2.36 Selenium users had been facing issues with it. Here is one of the threads :

The root cause is related to the commit regarding :

  • Remove --disable-infobars

    So, a couple of possible solution will be to :

  • To use ChromeOptions Class to maximize the browser.

  • Remove the option disable-infobars
  • An example :

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    options = Options()
    options.add_argument("start-maximized")
    driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:pathochromedriver.exe')
    driver.get('https://www.google.co.in')
    print("Page Title is : %s" %driver.title)
    

If your issue still persists consider the following :

  • Upgrade Selenium Python Client to current levels Version 3.10.0.
  • Upgrade ChromeDriver to stable ChromeDriver v2.35 level.
  • Keep Chrome version at Chrome v64.x levels. (as per ChromeDriver v2.35 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 Chrome version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Chrome.
  • Execute your Test.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...