解决python3配置常见错误 selenium3之Firefox geckodriver

本文详细介绍了使用Python3的Selenium3库与Firefox浏览器配合时遇到的四个常见错误:1) geckodriver不在PATH中;2) 未找到Firefox浏览器二进制位置;3) 不支持的Marionette协议版本;4) WebDriverException: newSession。解决方案包括将geckodriver添加到环境变量,确保Firefox浏览器路径在PATH中,升级Firefox版本至47以上,以及确保使用最新版geckodriver并置于Python安装目录下。
摘要由CSDN通过智能技术生成

第一个坑:’geckodriver’ executable needs to be in PATH
1.如果启动浏览器过程中报如下错误

Traceback (most recent call last):File "", line 1, in File "D:\test\python3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__self.service.start()File "D:\test\python3\lib\site-packages\selenium\webdriver\common\service.py", line 81, in startos.path.basename(self.path), self.start_error_message)selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

2.这个是因为最新的selenium3.0启动firefox需要geckodriver.exe这个驱动文件。
3.下载之后,配置到环境变量path下(可以直接放python根目录)

第二坑:Expected browser binary location, but unable to find binary in default location
1.如果启动浏览器过程中报如下错误:

Traceback (most recent call last):File ""
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值