Skip to content

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

Closed
@olezhlviv

Description

@olezhlviv

🐛 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): -

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions