有没有人使用过 Webdriver 的 ActionChains(python 绑定)? [英] Has anyone used ActionChains of Webdriver(python binding)?

查看:25
本文介绍了有没有人使用过 Webdriver 的 ActionChains(python 绑定)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 ActionChains 中使用 move_to_element 触发鼠标悬停事件,但无法正常工作.任何帮助表示赞赏.谢谢.

Im trying to trigger mouse over event using move_to_element in ActionChains, Couldn't get it working. Any help is appreciated. Thanks.

推荐答案

from selenium.webdriver.common.action_chains import ActionChains

ActionChains(drivers).move_to_element(drivers.find_element_by_id('element_id')).click().perform()

如果你想选择任何值,

 menu1 = drivers.find_element_by_xpath('html/path/of/select/box')
 sub_menu0 = drivers.find_element_by_xpath('html/path/of/selected/option')
 clickon = drivers.find_element_by_xpath(path/of/option/where/you/want/to/click)
 action = ActionChains(drivers)
 action.move_to_element(menu1)
 action.move_to_element(sub_menu0)
 action.click(clickon)
 action.perform()

这篇关于有没有人使用过 Webdriver 的 ActionChains(python 绑定)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆