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

yipeiwu_com6年前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 计算文件的md5值实例

较小文件处理方法: import hashlib import os def get_md5_01(file_path): md5 = None if os.path.is...

Python 动态导入对象,importlib.import_module()的使用方法

背景 一个函数运行需要根据不同项目的配置,动态导入对应的配置文件运行。 解决 文件结构 a #文件夹 │a.py │__init__.py b #文件夹 │b.py │__i...

python-str,list,set间的转换实例

实例如下: a = '123abbcc!@#' b = ['1', '2', '3', 'a', 'b', 'c', '!', '@', '#'] c = set(['a', '!...

python基于itchat模块实现微信防撤回

有时候,女神发来一条消息,说约你看电影,她考虑了一下,又撤回了,不约你了…而你又想知道她究竟发了什么,该怎么办?微信防撤回了解一下。 环境要求 Python3 电脑 安装itcha...

Python实现的金山快盘的签到程序

复制代码 代码如下:__author__ = 'clownfish'#coding:utf-8import urllib2,urllib,cookielib,json username...