selenium中ActionChains的perform()报错问题

zealot_001 2019-11-05 12:30:11
源码:
driver.find_element_by_class_name("login_switch_btn_box").click()
driver.find_element_by_id("username").send_keys('xxxx')
driver.find_element_by_id("password").send_keys('xxxx')
button = driver.find_element_by_class_name('login_switch_btn_box')
action = ActionChains(driver)
action.click_and_hold(button).perform()

报错信息:
/Users/luhaotian/Disk/PycharmProjects/RobotWX/bin/python /Users/luhaotian/Disk/PycharmProjects/RobotWX/test.py
Traceback (most recent call last):
File "/Users/luhaotian/Disk/PycharmProjects/RobotWX/test.py", line 16, in <module>
action.click_and_hold(button).perform()
File "/Users/luhaotian/Disk/PycharmProjects/RobotWX/lib/python3.8/site-packages/selenium/webdriver/common/action_chains.py", line 80, in perform
self.w3c_actions.perform()
File "/Users/luhaotian/Disk/PycharmProjects/RobotWX/lib/python3.8/site-packages/selenium/webdriver/common/actions/action_builder.py", line 76, in perform
self.driver.execute(Command.W3C_ACTIONS, enc)
File "/Users/luhaotian/Disk/PycharmProjects/RobotWX/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/luhaotian/Disk/PycharmProjects/RobotWX/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite.
(Session info: chrome=78.0.3904.87)

报错是在最后一句perform()导致,但是没查到什么原因
...全文
1392 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2019-12-09
  • 打赏
  • 举报
回复
老贴最后桌面解决的
平凡之路漫漫 2019-12-06
  • 打赏
  • 举报
回复
我也碰到了这个问题,好像和浏览器版本有关。我两台机器,一台正常一台报这个错。而且不报错的那台用move_by_offset滑动滑块起来非常流畅。另一台会停顿。 两者都是ubuntu18.04 。那台很顺滑的是chrome74 ,不顺滑还出这个错的,也是chrome78

37,716

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧