參考兩位大佬的文章:代碼實(shí)現(xiàn)對(duì)selenium的驅(qū)動(dòng)器WebDrive的配置_疏狂難除的博客-CSDN博客
selenium打開瀏覽器報(bào)錯(cuò)成功解決selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain...-CSDN博客
直接上報(bào)錯(cuò):
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
參考兩位的文章后感覺報(bào)錯(cuò)原因是尋找路徑失敗或沖突的問題。
因?yàn)檫\(yùn)行過程中導(dǎo)入了from selenium.webdriver.chrome.service import Service用來(lái)指定路徑下驅(qū)動(dòng),導(dǎo)致處理異常。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-762658.html
解決辦法:同類型原因?qū)е碌膱?bào)錯(cuò),直接刪去driver =webdriver.Chrome(options=chrome_options, service=service)中的service參數(shù)即可。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-762658.html
到了這里,關(guān)于關(guān)于selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain...的處理的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!