selenium中ActionChains的perform()报错问题
源码:
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()导致,但是没查到什么原因