from selenium import webdriverfrom selenium.webdriver.common.keys import Keysdriver = webdriver.Firefox()driver.get("http://www.baidu.com")driver.maximize_window()driver.find_element_by_id("kw").send_keys("seleniumm")driver.find_element_by_id("kw").send_keys(Keys.BACKSPACE) #删除多输入的mdriver.find_element_by_id("kw").send_keys(Keys.SPACE) #输入空格键driver.find_element_by_id("kw").send_keys(Keys.CONTROL,"a") #ctrl+a全选输入框内容driver.find_element_by_id("kw").send_keys(Keys.CONTROL,"x") #ctrl+x剪切driver.find_element_by_id("kw").send_keys(Keys.CONTROL,"c") #ctrl+c复制driver.find_element_by_id("kw").send_keys(Keys.CONTROL,"v") #ctrl+v粘贴driver.find_element_by_id("kw").send_keys(Keys.ENTER) #回车键driver.find_element_by_id("kw").send_keys(Keys.TAB) #制表键tabdriver.find_element_by_id("kw").send_keys(Keys.ESCAPE) #回退键enterdriver.find_element_by_id("kw").send_keys(Keys.F1) #键盘F1driver.find_element_by_id("kw").send_keys(Keys.F12) #键盘F12