Python Selenium WebDriver drag-and-drop

0
0

I cannot get drag-and drop working with the Python WebDriver bindings. I am working with Google Chrome and Firefox on Mac OS X. There is a thread here where someone had a similar problem.

I have tried using ActionsChains:

from selenium import webdriver
from selenium.webdriver import ActionChains
driver
= webdriver.Chrome()
actionChains
= ActionChains(driver)
actionChains
.drag_and_drop(source, target).perform()

Have you managed to get the Python WebDriver drag-and-drop working?

  • You must to post comments
1
0

For the sake of giving an updated answer, I have verified that this does in fact work on Mac now.

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()

Reference

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website