Skip to content

Action Class not working in all the Latest browsers and Selenium C# V"4.0.0-beta4" or in "4.0.0-rc1" #9800

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
svadivel0006 opened this issue Sep 7, 2021 · 6 comments
Labels
G-w3c Requires change to W3C Spec

Comments

@svadivel0006
Copy link

svadivel0006 commented Sep 7, 2021

💥 Regression Report

Action Class not working in all the latest browsers and Selenium C# V"4.0.0-beta4" or in "4.0.0-rc1", such as 'Drag and Drop', 'Click and Hold', etc..

Code :

using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Interactions;


namespace ActionsClass
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void Edge()
        {
            IWebDriver driver = new EdgeDriver(@"\Edge\93.0.961.38\X64");

            driver.Navigate().GoToUrl("https://www.seleniumeasy.com/test/drag-and-drop-demo.html");

            Actions act = new Actions(driver);

            Thread.Sleep(4000);

            IWebElement src1 = driver.FindElement(By.XPath("//span[text()='Draggable 1']"));
            IWebElement tar1 = driver.FindElement(By.XPath("//div[@id='mydropzone']"));

            Thread.Sleep(4000);

            IAction dragAndDrop1 = act.ClickAndHold(src1).MoveToElement(tar1).Release(src1).Build();
            dragAndDrop1.Perform();

            driver.Close();

        }
        
        [TestMethod]
        public void Chrome()
        {
            IWebDriver driver = new ChromeDriver(@"\Chrome\93.0.4577.15");

            driver.Navigate().GoToUrl("https://www.seleniumeasy.com/test/drag-and-drop-demo.html");

            Actions act = new Actions(driver);

            IWebElement src2 = driver.FindElement(By.XPath("//span[text()='Draggable 2']"));
            IWebElement tar1 = driver.FindElement(By.XPath("//div[@id='mydropzone']"));

            Thread.Sleep(4000);

            act.DragAndDrop(src2, tar1)
                .Build()
                .Perform();

            Thread.Sleep(4000);

            driver.Close();

        }

        [TestMethod]
        public void Firefox()
        {
            IWebDriver driver = new FirefoxDriver(@"\Firefox\0.29.1\X64");

            driver.Navigate().GoToUrl("https://www.seleniumeasy.com/test/drag-and-drop-demo.html");

            Actions act = new Actions(driver);

            //Ctl + t - for opening a new tab

            act.KeyDown(Keys.LeftControl)
                       .SendKeys("t")
                       .KeyDown(Keys.LeftControl)
                       .Build()
                       .Perform();

            driver.Close();

        }

        [TestMethod]
        public void IExplorer()
        {

            IWebDriver driver = new InternetExplorerDriver(@"\InternetExplorer\3.150.1\X64");

            driver.Navigate().GoToUrl("https://www.seleniumeasy.com/test/drag-and-drop-demo.html");

            Actions act = new Actions(driver);

             //alt + f + x - for clsoing the tab

            act.KeyDown(Keys.Alt)
               .SendKeys("f")
               .SendKeys("x")
               .Build()
               .Perform();

            //driver.Close();

        }
    }
}

A clear and concise description of what the regression is.

Last working Selenium version

Worked up to version:

Stopped working in version:

To Reproduce

Detailed steps to reproduce the behavior:

Expected behavior

It was working in the previous version of the browser and Selenium C3

Test script reproducing this issue (when applicable)

Please provide a test script to reproduce the issue you are reporting, if the
setup is more complex, GitHub repo links with are also OK.

Issues without a reproduction script are likely to stall and eventually be closed.

Environment

OS:
Browser:
Browser version:
Browser Driver version:
Language Bindings version:
Selenium Grid version (if applicable):

@ghost ghost added the A-needs-triaging A Selenium member will evaluate this soon! label Sep 7, 2021
@titusfortner titusfortner added A-needs decision TLC needs to discuss and agree and removed A-needs-triaging A Selenium member will evaluate this soon! A-needs decision TLC needs to discuss and agree labels Sep 8, 2021
@titusfortner
Copy link
Member

This looks like a duplicate of #8003 and is ultimately an issue with the drivers. As such the open ticket is in w3c with w3c/webdriver#1488; The tests are failing across all browsers at the bottom here: https://wpt.fyi/results/webdriver/tests/perform_actions/pointer.py & Chromium is tracking it here:
https://bugs.chromium.org/p/chromium/issues/detail?id=850071

The issue I think we need to address is that the Selenium tests are passing because we are testing against a JS library that shows the pointer getting moved, but the real-world implementations use the draggable="true" element attribute, which isn't working. I think we should update our specs to represent a basic real-world example like this - https://github.com/saucelabs/the-internet/blob/master/views/drag_and_drop.erb

Also, @christian-bromann am I reading this JS code right, that wdio addressed this issue by getting the coordinates of the target and moving by coordinate offset (since that approach does seem to work)? - https://github.com/webdriverio/webdriverio/pull/6600/files

@svadivel0006
Copy link
Author

Hi,

Thanks for the update, the issue not only with "Drag and Drop" functionality but other Mouse Actions in the Action class such

.KeyDown(Keys.LeftControl)
.SendKeys("t")
.KeyDown(Keys.LeftControl),
ClickAndHold, etc..

As mentioned in the bug log, the issue was reported in 2017 & closed, and again it was reported in 2020 which was too closed.

Kindly confirm whether for the new browsers released, the drivers are not updated properly which causes the issues and can a solution be expected a soon

As mentioned in getting the coordinates of the target and moving by coordinate offset is working

@christian-bromann
Copy link
Contributor

Also, @christian-bromann am I reading this JS code right, that wdio addressed this issue by getting the coordinates of the target and moving by coordinate offset (since that approach does seem to work)? - https://github.com/webdriverio/webdriverio/pull/6600/files

I still see people with issues using dragAndDrop but this is mostly related to the web app. We are testing it on a basic app where it works.

@jimevans
Copy link
Member

jimevans commented Sep 8, 2021

@svadivel0006 Updating the drivers is not a feature of the Selenium project. The user is responsible for updating drivers to the most recent versions. As the issue is in the drivers, it is the responsibility of the maintainers of the drivers (i.e., the browser developer, like Google, Mozilla, Microsoft, or Apple) to fix the issue in their code. As mentioned in other reports on the same issue, there has been a test for the scenario added to the common test suite that browser manufacturers use, and it’s up to them to make that test pass. In the meantime, there is nothing the language bindings can do about it.

@AutomatedTester AutomatedTester added the G-w3c Requires change to W3C Spec label Sep 8, 2021
@AutomatedTester
Copy link
Member

Closing this issue as our code, when browser vendors fix their code, will remain the same and there is nothing for us to do. Please follow up with each browser vendor.

@github-actions
Copy link

github-actions bot commented Oct 9, 2021

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

@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
G-w3c Requires change to W3C Spec
Projects
None yet
Development

No branches or pull requests

5 participants