Selenium鼠标悬停出现 TypeError: move_to_element() missing 1 required positional argument: 'to_element’
项目场景:
提示:这里简述项目相关背景:想要使用鼠标悬停操作,去获得隐藏列表
问题描述:
出现如下错误
TypeError: move_to_element() missing 1 required positional argument: 'to_element'
原因分析:
没有对Actionchains进行实例化
解决方案:
提示:这里填写该问题的具体解决方案:
原代码
more_files_btn=driver.find_element_by_css_selector("span.btn.btn-sm.btn-light")
ActionChains.move_to_element(more_files_btn).perform()
###修改后的代码
more_files_ele=driver.find_element_by_css_selector("span.btn.btn-sm.btn-light")
ActionChains(driver).move_to_element(more_files_ele).perform()