标签:context cli bsp ext 操作 family ble rop form
鼠标的操作有:单击,右击,双击,拖动,鼠标悬停
鼠标操作的方法封装在ActionChains()类里,需要引入ActionChains类
ActionChains提供的常用方法:
例子:
from selenium import webdriver #引入ActionChains类 from selenium.webdriver.common.action_chains import ActionChains driver=webdriver.Firfox() driver.get("http://yunpan.360.com") #右击 right_click=driver.find_element_by_id("xx") ActionChains(driver).context_click(right_click).perform() #鼠标悬停 above=driver.find_element_by_id("id") ActionChains(driver).move_to_element(above).perform() #双击 double_click=driver.find_element_by_id("xx") ActionChains(driver).double_click(double_click).perform() #鼠标拖放,移动前的位置,移动后的位置,执行拖动操作 element=driver.find_element_by_id("xx") target=driver.find_element_by_id("xx") ActionChains(driver).drag_and_drop(element,target).perform()
标签:context cli bsp ext 操作 family ble rop form
原文地址:https://www.cnblogs.com/daokeren/p/10236271.html