1. # -*-coding:utf-8一*-
2. # @Time:2021/1/13
3. # @Author: 大海
5. from selenium import webdriver
6. from selenium.webdriver.common.action_chains import ActionChains
8. driver = webdriver.Chrome()
9. driver.get("https://www.baidu.com")
10. # 隐式等待,后面介绍
11. driver.implicitly_wait(10)
12. # 鼠标悬停在搜索设置按钮上
13. mouse = driver.find_element_by_link_text("设置")
14. # ActionChains类需将驱动driver作为参数传入
15. # perform() 执行move_to_element(mouse) 鼠标悬浮的动作
16. ActionChains(driver).move_to_element(mouse).perform()
17.