处理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设计】网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

相关文章

pytorch:torch.mm()和torch.matmul()的使用

如下所示: torch.mm(mat1, mat2, out=None) → Tensor torch.matmul(mat1, mat2, out=None) → Tensor...

PyTorch的自适应池化Adaptive Pooling实例

PyTorch的自适应池化Adaptive Pooling实例

简介 自适应池化Adaptive Pooling是PyTorch含有的一种池化层,在PyTorch的中有六种形式: 自适应最大池化Adaptive Max Pooling: torch....

基于Python实现文件大小输出

基于Python实现文件大小输出

在数据库中存储时,使用 Bytes 更精确,可扩展性和灵活性都很高。 输出时,需要做一些适配。 1. 注意事项与测试代码 1.需要考虑 sizeInBytes 为 None 的场景。...

python实现的简单抽奖系统实例

本文实例讲述了python实现的简单抽奖系统。分享给大家供大家参考。具体实现方法如下: #!/usr/bin/env python #coding=utf-8 from Tkinte...

python定时检查启动某个exe程序适合检测exe是否挂了

详见代码如下: 复制代码 代码如下: import threading import time import os import subprocess def get_process_c...