参考两位大佬的文章:代码实现对selenium的驱动器WebDrive的配置_疏狂难除的博客-CSDN博客
selenium打开浏览器报错成功解决selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain...-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用来指定路径下驱动,导致处理异常。文章来源:https://www.toymoban.com/news/detail-762658.html
解决办法:同类型原因导致的报错,直接删去driver =webdriver.Chrome(options=chrome_options, service=service)中的service参数即可。文章来源地址https://www.toymoban.com/news/detail-762658.html
到了这里,关于关于selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain...的处理的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!