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()

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM