from selenium import webdriverfrom selenium.webdriver.common.action_chains import ActionChainsdriver = webdriver.Chrome()driver.get(‘http://www.baidu.com‘)driver.implicitly_wait(10)‘‘‘ 鼠标悬停 mouse = driver.find_element_by_link_text(‘设置‘)ActionChains(driver).move_to_element(mouse).perform()driver.find_element_by_link_text(‘高级搜索‘).click()‘‘‘ ‘‘‘ 鼠标拖拽mouse1 = driver.find_element_by_link_text(‘xxxxx‘)mouse2 = driver.find_element_by_link_text(‘xxxxxx‘)ActionChains(driver).drag_and_drop(mouse1, mouse2).perform()‘‘‘ ‘‘‘鼠标右击mouse1 = driver.find_element_by_link_text(‘xxxxx‘)ActionChains(driver).context_click(mouse1).perform()‘‘‘ ‘‘‘鼠标双击mouse1 = driver.find_element_by_link_text(‘xxxx‘)ActionChains(driver).double_click(mouse1).perform()‘‘‘
原文地址:https://www.cnblogs.com/yueyanru/p/9389854.html
时间: 2024-10-10 18:56:44