Selenium3+python3--如何定位鼠标悬停才显示的元素

follow yoyo

定位鼠标悬停才显示的元素,要引入新模块

# coding:utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Firefox()
driver.get("http://www.baidu.com")
# 定位百度页面上鼠标悬停设置按钮
mouse = driver.find_element_by_link_text("设置")
ActionChains(driver).move_to_element(mouse).perform()
driver.find_element_by_link_text("高级搜索").click()

猜你喜欢

转载自www.cnblogs.com/shanliguniang/p/10647862.html