【无标题】

selenium版本过高引起的报错

1,selenium错误代码TypeError: init() got an unexpected keyword argument ‘firefox_profile’

实际代码运行结果

test_last.py:8: DeprecationWarning: firefox_profile has been deprecated, please use an Options object
fp = webdriver.FirefoxProfile()
Traceback (most recent call last):
File “test_last.py”, line 23, in
driver = webdriver.Firefox(options=Firefoxoptions, firefox_profile=fp)
TypeError: init() got an unexpected keyword argument ‘firefox_profile’

2,selenium错误代码AttributeError: module ‘selenium.webdriver’ has no attribute ‘FirefoxOptions’

实际代码运行结果

λ python test_last.py
Traceback (most recent call last):
File “test_last.py”, line 15, in
Firefoxoptions = webdriver.FirefoxOptions()
AttributeError: module ‘selenium.webdriver’ has no attribute ‘FirefoxOptions’

根本原因是Selenium 3.8以后版本中不推荐使用浏览器选项参数firefox_options。 浏览器选项参数现在在驱动程序中标准化为options。firefox_options、chrome_options和ie_options现在不推荐使用,相反,您必须使用options

最终解决办法是:降低selenium的版本至你程序适应的版本,本程序最终将selenium版本从4.10.0降低至3.8.0,程序正常运行。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值