from selenium import webdriver
#导入模块
from selenium.webdriver.common.keys import Keys
from time import sleep
driver=webdriver.Firefox()
driver.get("http://www.baidu.com")
driver.find_element_by_css_selector("#kw").send_keys("牧场物语")
sleep(3)
#全选
driver.find_element_by_css_selector("#kw").send_keys(Keys.CONTROL,'a')
sleep(3)
#复制/剪(剪贴就是把“c”换成“x”)
driver.find_element_by_css_selector("#kw").send_keys(Keys.CONTROL,'c')
sleep(3)
#再打开另一个网页
driver.get("https://www.so.com/")
sleep(3)
#找到输入框的元素,并且进行粘贴
driver.find_element_by_css_selector("#input").send_keys(Keys.CONTROL,'v')
sleep(3)
#点击搜索
driver.find_element_by_css_selector("#search-button").click()
sleep(3)
driver.quit()