selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for firefox using

意思大概是:selenium获取不到firefox的驱动(geckodriver.exe)

错误原因:1. firefox(或者其他的selenium浏览器驱动--e.g.webchrome、safari等)放置的位置不正确。

今天傻羊在用selenium爬虫的时候发现,原来能用的firefox 突然就报错说用不了,刚开始的时候针对版本不匹配的问题进行更改,包括降低版本、重新配置环境等一系列问题。其中

火狐的各历史版本:Firefox各历史版本链接

火狐各驱动历史版本:Firefox_selenium驱动各版本

谷歌驱动的各历史版本:Chrome各历史版本

谷歌浏览器的历史版本:谷歌浏览器历史版本

其中关于如何查找浏览器对应的、合适的selenium版本,仔细研读这些英文即可:

 下载好后,俺把驱动放在相应浏览器的根目录下,并添加到环境中:

 刚开始运行时没事,后来突然就报错:

selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for firefox using

俺也很纳闷,毕竟已经添加进环境变量了呀🤣;没办法,最后看有的博客说要添加进python的根目录,试了试,可以:

如何查看python根目录位置:cmd命令下输入

C:\Users\35470>where python 

返回:

C:\Users\35470\AppData\Local\Programs\Python\Python38-32\python.exe 
C:\Users\35470\AppData\Local\Microsoft\WindowsApps\python.exe 

注意:俺这里返回来两个位置,----可能是因为当初下载的时候整的,理论上应该1个才对。虽然这里是多个,其实只有一个是有效的----可以正常导入模块,而不是:

OK,将selenium的浏览器驱动放在python根目录下,就不再报错了

 ----后续还会更新,2023-2005:

前天晚上还能跑,大早上一起来发现又报错:

大致意思是“当前的chromedriver已经不匹配目前的Google版本”,不知道怎么着Google背着我更新了?,没办法,去查chromedriver的版本,发现没有117---还没有更新,只好降Google的版本;不过,在卸软件前,建议先导出书签、同时选择‘保留现有数据’的方式,就不用重装之后再一个个捣鼓了………………

这里是傻羊,欢迎提问🥰🥰🥰

Unable to obtain driver using Selenium Manager: Selenium Manager failed for: E:\excavate\other\lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser firefox --output json. error sending request for url (https://github.com/mozilla/geckodriver/releases/latest): connection error: connection reset Traceback (most recent call last): File "E:\Two\pythonProject\main.py", line 3, in <module> driver = webdriver.Firefox() File "E:\excavate\other\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 195, in __init__ self.service.path = DriverFinder.get_path(self.service, options) File "E:\excavate\other\lib\site-packages\selenium\webdriver\common\driver_finder.py", line 43, in get_path raise err File "E:\excavate\other\lib\site-packages\selenium\webdriver\common\driver_finder.py", line 40, in get_path path = shutil.which(service.path) or SeleniumManager().driver_location(options) File "E:\excavate\other\lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 91, in driver_location result = self.run(args) File "E:\excavate\other\lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 112, in run raise SeleniumManagerException(f"Selenium Manager failed for: {command}.\n{result}{stderr}") selenium.common.exceptions.SeleniumManagerException: Message: Selenium Manager failed for: E:\excavate\other\lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser firefox --output json. error sending request for url (https://github.com/mozilla/geckodriver/releases/latest): connection error: connection reset Process finished with exit code 1
06-07
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值