Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions class methods for dragging and dropping does not work #7782

Closed
olezhlviv opened this issue Nov 13, 2019 · 4 comments
Closed

Actions class methods for dragging and dropping does not work #7782

olezhlviv opened this issue Nov 13, 2019 · 4 comments

Comments

@olezhlviv
Copy link

馃悰 Bug Report

I have faced with an issue that drag and drop does not work for logic in my application.
I am using C# for triggering the tests.
To verify if it is issue with my project or with WebDriver I have created simple project that tries to drag and drop in https://www.seleniumeasy.com/test/drag-and-drop-demo.html site.
It is reproducible for Chrome, IE, FF (in Chrome and FF it makes draggable element yellow but nothing happen, in IE - nothing happens.
The code is below:

var driver = new ChromeDriver();
            driver.Navigate().GoToUrl("https://www.seleniumeasy.com/test/drag-and-drop-demo.html");
            var from = driver.FindElementByXPath("//div[@id='todrag']/span");
            var to = driver.FindElementById("mydropzone");
            Actions action = new Actions(driver);

            action.DragAndDrop(from, to).Perform();

            action.ClickAndHold(from).MoveToElement(to).Build().Perform();
            action.ClickAndHold(from).MoveToElement(to).Release().Build().Perform();

            action.DragAndDropToOffset(from, to.Location.X, to.Location.Y).Build().Perform();

All these combinations does not work.
If not moving mouse to browser it throws
OpenQA.Selenium.WebDriverException: 'The HTTP request to the remote WebDriver server for URL http://localhost:63069/session/abde98f8ab6a2015869e043c17fcc285/actions timed out after 60 seconds.'

To Reproduce

Detailed steps to reproduce the behavior:

  1. Create a console project from scratch
  2. Add Selenium NuGet package
  3. Add code from above
  4. Run it

Expected behavior

Element should be dragged and dropped to droppable zone.

Test script or set of commands reproducing this issue

var driver = new ChromeDriver();
            driver.Navigate().GoToUrl("https://www.seleniumeasy.com/test/drag-and-drop-demo.html");
            var from = driver.FindElementByXPath("//div[@id='todrag']/span");
            var to = driver.FindElementById("mydropzone");
            Actions action = new Actions(driver);

            action.DragAndDrop(from, to).Perform();

            action.ClickAndHold(from).MoveToElement(to).Build().Perform();
            action.ClickAndHold(from).MoveToElement(to).Release().Build().Perform();

            action.DragAndDropToOffset(from, to.Location.X, to.Location.Y).Build().Perform();

Environment

OS: Windows 10
Browser: Chrome (latest), FF (latest), IE
Browser version: 78.0.3904.97
Browser Driver version: 78.0.3904.7000
Language Bindings version: C#
Selenium Grid version (if applicable): -

@olezhlviv
Copy link
Author

Reproducible on different computers

@adrianer
Copy link

adrianer commented Feb 13, 2020

I can confirm the same issue using the latest Python version of Selenium. Tested with Chrome 80 and Firefox 72.0.2 (local, not remote).

Code to reproduce:

driver.get("https://www.seleniumeasy.com/test/drag-and-drop-demo.html")
ac = ActionChains(driver)
sleep(2)
drag = driver.find_element_by_id("todrag").find_elements_by_tag_name("span")[1]
drop = driver.find_element_by_id("mydropzone")
ac.drag_and_drop(drag, drop)
ac.perform()

@AutomatedTester
Copy link
Member

Duplicate of #8003

@AutomatedTester AutomatedTester marked this as a duplicate of #8003 Mar 19, 2020
@lock
Copy link

lock bot commented Apr 18, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants