首页 > 其他 > 详细

鼠标操作

时间:2021-03-30 09:33:47      阅读:20      评论:0      收藏:0      [点我收藏+]

鼠标操作:
移动:action.move_to_element(setting).perform()
拖拽:action.drag_and_drop(setting1,setting2).perform()
双击:action.double_click(setting).perform()
右击:action.context_click(setting).perform()
单击:action.click(setting).perform()

技术分享图片

 

 

 定位百度上面设置里面的高级搜索为例:

from selenium import webdriver
from selenium.webdriver import ActionChains
import time
driver = webdriver.Firefox()
url = "https://www.baidu.com/"
driver.get(url)
#初始化ActionChains
action = ActionChains(driver)
#定位一个元素
setting = driver.find_element(‘xpath‘,"//span[text()=‘设置‘]")
#鼠标操作
#移动
action.move_to_element(setting).perform()
time.sleep(6)
driver.find_element(‘xpath‘,"//a[text()=‘高级搜索‘]").click()
driver.quit()

 

鼠标操作

原文:https://www.cnblogs.com/jiang12/p/14594724.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!