[英]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 : 您的主要问题是您使用的二进制文件之间的版本兼容性如下:
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 )之间存在明显的不匹配
@Test
. 执行你的@Test
。 driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully. 始终在tearDown(){}
方法中调用driver.quit()
以正常关闭和销毁WebDriver和Web Client实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.