Skip to content

Unable to perform drag and drop with Selenium (python) #8003

Closed
@GuillaumeHarel

Description

@GuillaumeHarel

🐛 Bug Report

Hi there,

For test automation, I can't perform drag and drop or click and hold actions with Selenium in python on a private web app. No drag actions seems to be performed at all. I can't share the private app but I reproduce my bug on the following demo website :
http://the-internet.herokuapp.com/drag_and_drop

To Reproduce

Below is my basic piece of code for drag and drop / click and hold

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('http://the-internet.herokuapp.com/drag_and_drop')
dragged = driver.find_element(By.ID, "column-a")
dropped = driver.find_element(By.ID, "column-b")

#Drag and drop

actions = ActionChains(driver)
actions.drag_and_drop(dragged, dropped).perform() 
#column A is selected but not dragged

#Click and hold
actions = ActionChains(driver)
actions.move_to_element(dragged).click_and_hold().move_to_element(dropped).release().perform()
#Same result : column a is selected but not dragged

Detailed steps to reproduce the behavior: Juste reuse the code with the provided demo website.

Expected behavior

Block A and Block B should be switched.

Test script or set of commands reproducing this issue

Please, see the code above

Environment

OS:
Browser:
Browser version:
Browser Driver version:
Language Bindings version:
Selenium :

Thanks for your help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions