python 实现鼠标拖拽

详细工具见之前写的实现淘宝搜索。

from selenium import webdriver
from selenium.webdriver import ActionChains

browser=webdriver.Chrome()
url='http://www.runoob.com/try/try.php?filename=jqueryui-api-droppable'
browser.get(url)
browser.switch_to.frame('iframeResult')
source=browser.find_element_by_css_selector('#draggable')
target=browser.find_element_by_css_selector('#droppable')
actions=ActionChains(browser)
actions.drag_and_drop(source,target)
actions.perform()

猜你喜欢

转载自blog.csdn.net/qq_40771567/article/details/81030481