鼠标事件.py
from selenium import webdriver#引入ActionChains类:from selenium.webdriver.common.action_chains import ActionChainsdriver = webdriver.Chrome()driver.maximize_window()driver.get("https://yunpan.360.cn/")#定位到要右击的元素: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()#drag_and_drop(source,target)在源元素上按住鼠标左键、然后移动到目标元素上释放#source鼠标拖动的源元素#target鼠标释放的目标元素#定位元素的原位置element = driver.find_element_by_id("xx")#定位元素要移动的目标位置target = driver.find_element_by_id("xx")#执行鼠标的拖放操作ActionChains(driver).drag_and_drop(element,target).perform()
相关推荐
EdwardSiCong 2020-11-23
yungpheng 2020-10-19
jipengx 2020-11-12
橄榄 2020-11-03
lyqdanang 2020-11-02
wservices 2020-10-30
onepiecedn 2020-10-29
数据人 2020-10-26
dfphoto 2020-10-16
hackerlpy 2020-09-07
tianyayi 2020-08-16
Dullonjiang 2020-08-15
fengling 2020-08-15
wordmhg 2020-08-06
guotiaotiao 2020-08-06
zhangsyi 2020-07-28
千锋 2020-07-27
ahnjwj 2020-07-28