selenium - ActionChains的Python Selenium move_to_element方法不起作用
问题描述
driver = webdriver.Chrome()
driver.get('https://www.wikipedia.org/')
time.sleep(2)
actions = ActionChains(driver)
actions.move_by_offset(500, 500).perform()
move_to_element()
,move_to_element_by_offset()
任何功能都不起作用。
没有错误报告。
解决方案
我在您的代码试验中没有看到任何此类问题。但是需要注意的是,ActionChains是一种自动化低级别交互的方法,例如鼠标移动、鼠标按钮操作、按键和上下文菜单交互。此类对于执行复杂的操作也很有用,例如悬停和拖放。为了模拟所有这些低级交互和复杂动作,使用 ActionChains类,而不是直接使用键盘或鼠标。
因此,尽管该move_by_offset()
方法被明显执行,但您可能无法跟踪/跟踪它。
推荐阅读
- angular - 在 Angular 6 中使用 primeNg 进行服务器端分页
- elasticsearch - Elasticsearch 中的“映射”有什么作用?
- angular - Angular:route.params 返回“null”而不是 null
- javascript - 如何使用 id 在类中追加一个新元素
- kubernetes - 当我编辑和保存 pod yaml 时,如何修复“map [] 不包含声明的合并键:名称”错误?
- python - 如何在python pptx中设置背景图像
- appium-ios - 有时 Appium studio 不支持启动 IOS 设备
- c - atomic_exchange_explicit/atomic_exchange 引入的内存顺序
- java - OpenJ9 和 HostSpot G1 的弹性垂直缩放对比测试
- android - 在拥有两种类型的用户时从数据库中读取