Python Selenium WebDriver drag-and-drop

0 votes

The drag-and-drop is not working with the Python WebDriver bindings. I am working with Google Chrome and Firefox on Mac OS X. 

I used ActionsChains:

from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
actionChains = ActionChains(driver)

actionChains.drag_and_drop(source, target).perform()

How to get the Python WebDriver drag-and-drop work?

Aug 23, 2018 in Selenium by Perry
• 17,100 points
4,240 views

1 answer to this question.

0 votes

I have verified that this does in fact work on 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()


For more don't forget to check out this blog on how to drag and drop in Selenium?

answered Aug 23, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
1 answer

Selenium + Java - drag and drop not working on selenium 3.8

How about you try adding the below ...READ MORE

answered Mar 28, 2018 in Selenium by nsv999
• 5,500 points
5,147 views
0 votes
2 answers

Drag and drop in selenium

WebElement dragale = driver.findElement(By.xpath("//*[@id=\"draggable\"]/p")); WebElement dropable = driver.findElement(By.xpath("//*[@id=\"droppable\"]")); Actions ...READ MORE

answered May 4, 2020 in Selenium by dragAndDrop(WebElement source, WebElemen
1,520 views
0 votes
1 answer

Which methods which can be used to handle pop-up and alerts in Python Selenium Webdriver?

Hey Kishor, Python Selenium webdriver provides following ...READ MORE

answered Jul 29, 2019 in Selenium by Abha
• 28,140 points
993 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,674 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,143 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP