简体   繁体   English

Python selenium WebDriverException:打开ChromeDriver时无法访问chrome

[英]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. 我正在使用Selenium Chrome Webdriver在Python 3中打开一个网页。我希望有一个可以打开网页的功能。 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() 我把它放到函数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. 但是,我无法在该goTo函数之外的该页面上执行任何其他操作。 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? 有谁知道如何使用函数正确打开页面?

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 您正在使用chromedriver = 2.35
  • Release Notes of chromedriver=2.35 clearly mentions the following : chromedriver发行说明= 2.35明确提到以下内容:

Supports Chrome v62-64 支持Chrome v62-64

Supports Chrome v64-66 支持Chrome v64-66

So there is a clear mismatch between the ChromeDriver version ( v2.35 ) and the Chrome Browser version ( v65.0 ) 因此ChromeDriver版本( v2.35 )与Chrome浏览器版本( v65.0 )之间存在明显的不匹配

Solution

  • Upgrade Selenium to current levels Version 3.11.0 . Selenium升级到当前级别版本3.11.0
  • Upgrade ChromeDriver to current ChromeDriver v2.37 level. 升级ChromeDriver当前ChromeDriver v2.37水平。
  • Keep Chrome version at Chrome v65.x levels. Chrome版本保持在Chrome v65.x级别。 ( as per ChromeDriver v2.37 release notes ) 根据ChromeDriver v2.37发行说明
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only. 通过IDE 清理 项目工作区 ,并仅使用所需的依赖项重建项目。
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite . 使用CCleaner工具在执行测试套件之前和之后擦除所有操作系统。
  • 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 . 如果您的基本Web客户端版本太旧,请通过Revo Uninstaller将其卸载并安装最新的GA和已发布的Web客户端版本。
  • Take a System Reboot . 进行系统重启
  • Execute your @Test . 执行你的@Test
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully. 始终在tearDown(){}方法中调用driver.quit()以正常关闭和销毁WebDriverWeb Client实例。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python, selenium, chromedriver 'selenium.common.exceptions.WebDriverException: 消息:无法访问 u'chrome - python, selenium, chromedriver 'selenium.common.exceptions.WebDriverException: Message: u'chrome not reachable chrome 无法访问 Selenium webDriverException - chrome not reachable Selenium webDriverException Selenium WebDriverException-无法访问Chrome - Selenium WebDriverException - chrome not reachable python selenium:WebDriverException:消息:chrome无法访问 - python selenium: WebDriverException: Message: chrome not reachable selenium.common.exceptions.WebDriverException:消息:使用 find_element_by_id Selenium 和 ChromeDriver 时出现 chrome 无法访问错误 - selenium.common.exceptions.WebDriverException: Message: chrome not reachable error while using find_element_by_id Selenium with ChromeDriver selenium.common.exceptions.WebDriverException:消息:打开chrome浏览器时无法连接到服务chromedriver.exe - selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver.exe while opening chrome browser Python Selenium ChromeDriver 无法访问 - Python Selenium ChromeDriver Not Reachable selenium WebDriverException:消息:未知错误:使用Selenium Python使用ChromeDriver Chrome提取页面源时出现错误检查器消息 - selenium WebDriverException: Message: unknown error: bad inspector message while extracting page source with ChromeDriver Chrome using Selenium Python selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用带有Selenium Python的ChromeDriver Chrome创建Chrome进程 - selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process with ChromeDriver Chrome with Selenium Python WebDriverException:消息:未知错误:C:/.../Chrome/Application/chrome.exe 处没有 Chrome 二进制文件,带有 ChromeDriver Selenium 和 Python - WebDriverException: Message: unknown error: no chrome binary at C:/.../Chrome/Application/chrome.exe with ChromeDriver Selenium and Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM