处理Selenium3+python3定位鼠标悬停才显示的元素

yipeiwu_com5年前Python基础

先给大家介绍下Selenium3+python3--如何定位鼠标悬停才显示的元素

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

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

知识点扩展:

python selenium 鼠标悬停

#鼠标悬停
chain = ActionChains(driver)
implement = driver.find_element_by_link_text()
chain.move_to_element(implement).perform()

 模拟鼠标悬停后,后搜索需要内容

总结

以上所述是小编给大家介绍的处理Selenium3+python3定位鼠标悬停才显示的元素,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对【听图阁-专注于Python设计】网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

相关文章

Python安装官方whl包和tar.gz包的方法(推荐)

Windows环境:   安装whl包:pip install wheel    ->    pip install&n...

python使用response.read()接收json数据的实例

如下所示: import json result = response.read() result.decode('utf-8') jsonData = json.loads(r...

浅谈python和C语言混编的几种方式(推荐)

Python这些年风头一直很盛,占据了很多领域的位置,Web、大数据、人工智能、运维均有它的身影,甚至图形界面做的也很顺,乃至full-stack这个词语刚出来的时候,似乎就是为了描述它...

python 同时运行多个程序的实例

start many programs execfile('C:/Dokumente und Einstellungen/schnei17/Desktop/python/zeit/1...

python实现感知器算法详解

python实现感知器算法详解

在1943年,沃伦麦卡洛可与沃尔特皮茨提出了第一个脑神经元的抽象模型,简称麦卡洛可-皮茨神经元(McCullock-Pitts neuron)简称MCP,大脑神经元的结构如下图。麦卡洛可...