Selenium自动化之鼠标左键操作按下松开
发布时间
阅读量:
阅读量
#鼠标左键按下、松开操作
from selenium.webdriver import ActionChains
通过ActionChains(self.driver)实现对div元素的点击并保持按压状态,随后执行释放操作。
具体步骤为:首先调用click_and_hold方法并执行,接着使用release方法完成释放动作,最终通过perform()方法确认操作的执行。
import unittest
import time
from selenium import webdriver
from selenium.webdriver import ActionChains
class VisitSogouByIE(unittest.TestCase):
def setUp(self):
# 启动IE浏览器
self.driver = webdriver.Ie(executable_path="g:\ IEDriverServer")
def test_simulationLeftClickMouseOfProcess(self):
url = "http://127.0.0.1/test_mouse.html"
#
全部评论 (0)
还没有任何评论哟~
