WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Mouse Double-click

Open FBorges14 opened this issue 8 years ago • 3 comments

In some cases is useful to do double-click on a application and there is no method to do it.

I've tried do two times the Click() but it takes to long and the system does not understand as double-click.

FBorges14 avatar Jan 19 '18 14:01 FBorges14

Hi @FBorges14,

Double click mouse action is obviously useful and we have a proper example on how to do this on https://github.com/Microsoft/WinAppDriver/blob/v1.0/Tests/WebDriverAPI/Mouse.cs#L94. E.g.

session.Mouse.MouseMove(appNameTitle.Coordinates);
session.Mouse.DoubleClick(null); // Pass null as this command omit the given parameter

timotiusmargo avatar Jan 19 '18 19:01 timotiusmargo

We can use below code for double click on any element:

Actions action = new Actions(driver);
action.MoveToElement(ContactFromList).Click().DoubleClick().Build().Perform();

Perform a click() before DoubleClick() is for safe site. Application may need a click before double click otherwise you can skip it.

Neh18 avatar Mar 12 '20 07:03 Neh18

It is more convenient to write an extension method,

    internal static class Helper
    {
        public static void DoubleClick(this WindowsElement element)
        {
            new Actions(element.WrappedDriver)
                .MoveToElement(element)
                .Click()
                .DoubleClick()
                .Build()
                .Perform();
        }
    }

lextm avatar Oct 14 '20 04:10 lextm