一、键盘元素操作

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

2、键盘操作

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

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

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

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

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

制表键Tab:  send_keys(Keys.TAB)

回车:send_keys(Keys.ENTER)

 

二、鼠标操作

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

2、鼠标操作:通过perform()命令执行,如xx.content_click().perform()

 

右击鼠标:context_click()

 

双击鼠标:double_click()

鼠标悬停:move_to_element()

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-16
  • 2021-10-13
  • 2021-06-10
猜你喜欢
  • 2022-12-23
  • 2022-03-08
  • 2021-06-21
  • 2021-11-26
  • 2022-01-16
  • 2021-06-13
相关资源
相似解决方案