python自动化测试——键盘事件

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("https://www.***.cn")

#回车
driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.ENTER)
#空格 driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.SPACE)
#Tab driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.TAB)
#删除 driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.BACK_SPACE)
#Esc driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.ESCAPE)
#组合键Ctrl+C driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.CONTROL,'c')
#F1 driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.F1)
#Pagedown driver.find_element(By.CSS_SELECTOR,"***").send_keys(Keys.PAGE_DOWN) driver.quit()

 

 

 

posted @ 2019-02-15 16:05  OTAKU_nicole  阅读(1116)  评论(0编辑  收藏  举报