使用 ActionChains 的 move_by_offset 方法可以模拟鼠标移动到相对网页 x, y 坐标的位置。

# 创建 ActionChains 对象
actions = ActionChains(driver)

# 模拟鼠标移动到相对网页 x, y 坐标的位置
actions.move_by_offset(x, y).perform()

其中,x 和 y 分别表示相对于当前鼠标位置的横向和纵向位移量。perform() 方法用于执行操作。

# 创建 ActionChains 对象 actions = ActionChainsdriver使用selenium 的 ActionChains 模拟鼠标移动到 相对网页 xy坐标的位置

原文地址: http://www.cveoy.top/t/topic/iU5N 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录