我面临以下问题-
环境 Chrome版本-版本86.0.4240.75 (正式构建)( 64位)铬驱动器- ChromeDriver 86.0.4240.22 (从https://chromedriver.chromium.org/downloads下载) python 3.6.6 32位selenium - 3.141.0 ExpressVPN连接的Windows10Pro 64位系统
码
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
driver = webdriver.Chrome(options=options, executable_path='D:/chromedriver_win32/chromedriver.exe')
执行输出
D:\Assignment>python add_to_cart_v3.py
DevTools listening on ws://127.0.0.1:59948/devtools/browser/b3bea32b-25a1-47ff-800c-162e0200566a
Traceback (most recent call last):
File "add_to_cart_v3.py", line 67, in <module>
driver = webdriver.Chrome(options=options, executable_path=r'D:/chromedriver_win32/chromedriver.exe')
File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
当我断开Express VPN时,它可以正常工作。请分享您的意见,什么可能是问题在这里。
发布于 2020-10-16 20:17:21
试试这个,我和冲浪鲨鱼有同样的问题,但是这个解决了。使用pip安装webdriver_manager
。使用webdriver_manager,不需要下载chromedriver,它会自动检测到您的铬版本。
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)
https://stackoverflow.com/questions/64395784
复制相似问题