Ran*_*lue 13 python selenium webdriver
我无法使用Python WebDriver绑定进行拖放操作.我在Mac OS X上使用谷歌浏览器和Firefox.这里有一个线程,其中有人有类似的问题.
我尝试过使用ActionsChains:
from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
actionChains = ActionChains(driver)
actionChains.drag_and_drop(source, target).perform()
Run Code Online (Sandbox Code Playgroud)
你有没有设法让Python WebDriver拖放工作?
d_r*_*z90 13
为了给出更新的答案,我已经证实这确实可以在Mac上运行.
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox()
driver.get("your.site.with.dragndrop.functionality.com")
source_element = driver.find_element_by_name('your element to drag')
dest_element = driver.find_element_by_name('element to drag to')
ActionChains(driver).drag_and_drop(source_element, dest_element).perform()
Run Code Online (Sandbox Code Playgroud)