lundi 30 juillet 2018

Selenium DragWithCursor Test

I want to build a test case where the mouse cursor moves with the element and then assert that the position of the mouse is relative to the element ?

Any ideas ?

https://pastebin.com/cnzSCzb9

public IWebElement CursorStyle => this.Driver.FindElement(By.Id("ui-id-3"));

public IWebElement DragObjectCursor => this.Driver.FindElement(By.Id("drag"));

public void DragWithCursor()
        {

            Actions action = new Actions(this.Driver);
            action.MoveToElement(this.DragObjectCursor)
                .ClickAndHold()
                .MoveByOffset(50, 50)
                .Perform();
        }

public void GoToUrl()
        {
            this.Driver.Url = "http://demoqa.com/draggable/";
        }

[Test]

public void DragElementCursorStyle()
        {
            _dragPage.GoToUrl();
            _dragPage.CursorStyle.Click();

            Thread.Sleep(2000);

            _dragPage.DragWithCursor();

            Thread.Sleep(3000);
        }

http://demoqa.com/draggable/

Aucun commentaire:

Enregistrer un commentaire