ActionChains报错问题总结

在使用Python2.7+Selenium3.0.2+Firefox50.1时,鼠标事件ActionChains运行总是报错,报错信息如下:

C:\Python36\python3.exe C:/Users/root/PycharmProjects/untitled3/test170117.py
Traceback (most recent call last):
  File "C:/Users/root/PycharmProjects/untitled3/test170117.py", line 458, in <module>
    ActionChains(driver).move_to_element(set).perform()
  File "C:\Python36\lib\site-packages\selenium\webdriver\common\action_chains.py", line 74, in perform
    action()
  File "C:\Python36\lib\site-packages\selenium\webdriver\common\action_chains.py", line 225, in <lambda>
    Command.MOVE_TO, {'element': to_element.id}))
  File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "C:\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: POST /session/3ba988a1-5c6f-4999-8815-71d40e62a6af/moveto did not match a known command
 
经过搜索,说是geckodriver和Firefox有Bug,最后将Selenium3.0.2换成Selenium2.53.0(此时环境为Python2.7+Selenium2.53.0+Firefox50.1),此时运行python脚本时,报错:
报错信息忘了截图了?????
搜索后,说是因为Selenium支持Firefox及其以下版本,所以最后环境变为:Python2.7+Selenium2.53.0+Firefox46,问题解决,ActionChains()类下的各种鼠标操作方法完美运行。
github上该Bug相关信息:
https://github.com/SeleniumHQ/selenium/issues/2285
https://github.com/mozilla/geckodriver/issues/159

转载于:https://www.cnblogs.com/csjd/p/6337946.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值