selenium如何定位鼠标悬停才显示的按钮

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

driver = webdriver.Firefox()
driver.get("http://xxxxxxx.com")
# 定位鼠标悬停才显示的“退出登录”按钮
mouse = self.driver.find_element_by_xpath("//*[contains(text(),'hello')]")
ActionChains(self.driver).move_to_element(mouse).perform()
self.driver.find_element_by_xpath("//*[contains(text(),'退出登录')]").click()

 

posted on 2020-11-17 15:28  Tester十点半  阅读(780)  评论(0编辑  收藏  举报

导航