#键盘操作
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from time import sleep
driver=webdriver.Chrome()
driver.get("http://www.baidu.com")
driver.find_element_by_id('kw').send_keys("python")
sleep(2)
driver.find_element_by_id('su').click()
#键盘全选
driver.find_element_by_id('kw').send_keys(Keys.CONTROL,'a')
sleep(2)
#键盘复制和粘贴
driver.find_element_by_id('kw').send_keys(Keys.CONTROL,'c')
driver.find_element_by_id('kw').send_keys(Keys.CONTROL,'x')
#复制到搜狗页
driver.get("http://www.sogou.com")
sleep(2)
#键盘粘贴
driver.find_element_by_css_selector(".sec-input").send_keys(Keys.CONTROL,'v')
sleep(2)
#点击搜索
driver.find_element_by_id('stb').click()
sleep(3)
driver.quit()