from selenium import webdriver
from selenium.webdriver import ActionChains
import time
driver=webdriver.Chrome()
driver.get("http://www.baidu.com")
driver.maximize_window()
driver.find_element_by_css_selector('#kw').send_keys('python')
element=driver.find_element_by_css_selector('#kw')
sleep(2)
#鼠标双击操作
ActionChains(driver).double_click(element).perform()
#鼠标右击操作
ActionChains(driver).context_click(element).perform()
鼠标悬停
above = driver.find_element_by_css_selector(".pf")
ActionChains(driver).move_to_element(above).perform()
sleep(3)
driver.quit()