selenium+python之操做元素

1、键盘元素操做web

一、导入Keys: from selenium.webdriver.common.keys import Keysspa

二、键盘操做orm

键盘F1到F12:send_keys(Keys.F1) 把F1改为对应的快捷键element

复制Ctrl+C:send_keys(Keys.CONTROL,'c') selenium

粘贴Ctrl+V:send_keys(Keys.CONTROL,'v') io

 全选Ctrl+A:send_keys(Keys.CONTROL,'a') form

剪切Ctrl+X:send_keys(Keys.CONTROL,'x') import

制表键Tab:  send_keys(Keys.TAB)
cli

回车:send_keys(Keys.ENTER)im

 

2、鼠标操做

一、导入ActionChains:from selenium.webdriver.common.action_chains import ActionChains

二、鼠标操做:经过perform()命令执行,如xx.content_click().perform()

 

右击鼠标:context_click()

 

双击鼠标:double_click()

鼠标悬停:move_to_element()

相关文章
相关标签/搜索