python之web自动化<二>

python之web自动化<二>,第1张

一、鼠标 *** 作

由selenium的ActionChains来模拟鼠标 *** 作,主要的 *** 作流程。
1、储存鼠标的 *** 作
2、perform()来执行鼠标的 *** 作。

支持的 *** 作如下:
double_click 双击 *** 作
context_click 右键 *** 作
drag_and_drop 拖拽 *** 作。 左键按住拖动某一个元素到另外一个区域,然后释放按键
move_to_element() 鼠标悬停,以后会经常遇到

细说:
perform() 比较特殊,先将 *** 作村放在一个列表中,然后用perform方法去全部执行列表中的 *** 作。
引用ActionChains类:
ActionChains(driver).click(xx).context_click().perform()

from selenium.webdriver.common.action_chains import ActionChains
 ActionChains(driver).move_to_element(menu).click(hidden_submenu).perform() --连续 *** 作
 actions = ActionChains(driver)
        actions.move_to_element(menu)
        actions.click(hidden_submenu)
        actions.perform()

键盘 *** 作

下拉列表

上传JS处理

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/926647.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-16
下一篇 2022-05-16

发表评论

登录后才能评论

评论列表(0条)

保存