关于selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain...的处理
解决办法:同类型原因导致的报错,直接删去driver =webdriver.Chrome(options=chrome_options, service=service)中的service参数即可。因为运行过程中导入了from selenium.webdriver.chrome.service import Service用来指定路径下驱动,导致处理异常。参考两位的文章后感觉报错原因是寻找路径失败
文章共327字 · 阅读需要大约2分钟
一键AI生成摘要,助你高效阅读
问答
·
参考两位大佬的文章:代码实现对selenium的驱动器WebDrive的配置_疏狂难除的博客-CSDN博客
直接上报错:
driver = webdriver.Chrome(options=chrome_options, service=service)
File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 47, in __init__
self.service.path = DriverFinder.get_path(self.service, self.options)
File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/common/driver_finder.py", line 44, in get_path
raise NoSuchDriverException(f"Unable to obtain {service.path} using Selenium Manager; {err}")
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain ../data/chromedriver using Selenium Manager; Message: Unsuccessful command executed: /root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/common/linux/selenium-manager --browser chrome --output json.
error sending request for url (https://chromedriver.storage.googleapis.com/LATEST_RELEASE_105): operation timed out
; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
参考两位的文章后感觉报错原因是寻找路径失败或冲突的问题。
因为运行过程中导入了from selenium.webdriver.chrome.service import Service用来指定路径下驱动,导致处理异常。
解决办法:同类型原因导致的报错,直接删去driver =webdriver.Chrome(options=chrome_options, service=service)中的service参数即可。
更多推荐
已为社区贡献1条内容
所有评论(0)