appium: Actions not working with WinAppDriver

The problem

Appears no Actions work when using Appium to connect to WinAppDriver.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.22.1, 1.22.2-rc.0, and likely all version
  • Desktop OS/version used to run Appium: Windows 10
  • Node.js version (unless using Appium.app|exe): 16.13.1
  • Npm or Yarn package manager: NPM
  • Mobile platform/version under test: Windows 10
  • Real device or emulator/simulator: Real
  • Appium CLI or Appium.app|exe: Both

Details

Many actions fail with either: Currently only pen and touch pointer input source types are supported or Currently key input source type is not supported

Link to Appium logs

Fails when using Appium https://gist.github.com/TroyWalshProf/f939ed48156157f9257d4c06fad6775a#file-appiumwithwinappkeysandactions-txt

Passes when using WinAppDriver directly https://gist.github.com/TroyWalshProf/1a86d5c4331fbf1fd242021018edfe9a#file-winappdirectsendkeysandactions-txt *Due to WinAppDriver not currently supporting W3C standard this requires the use of Appium built off Selenium 3 interface

Code To Reproduce Issue [ Good To Have ]

See the bug:

public class UsingAppiumFiveAndAppiumNpm : BaseAppiumTest
{
    /// <summary>
    /// Setup Appium driver
    /// </summary>
    /// <returns>Appium driver</returns>
    protected override AppiumDriver GetMobileDevice()
    {
        // Will need to start Appium before running
        AppiumOptions options = new AppiumOptions();
        options.App = "Root";

        // Connect to Appium
        return AppiumDriverFactory.GetWindowsDriver(new Uri("http://127.0.0.1:4723/wd/hub"), options, TimeSpan.FromSeconds(30));
    }

    [Test]
    public void LauchFromRunner()
    {
        // Launch windows run
        new Actions(this.AppiumDriver).SendKeys(Keys.Command + "r" + Keys.Command).Build().Perform();
        By CommandRunnerBy = By.XPath("/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Window[@ClassName=\"#32770\"][@Name=\"Run\"]/ComboBox[@ClassName=\"ComboBox\"][@Name=\"Open:\"]/Edit[@ClassName=\"Edit\"][@Name=\"Open:\"]");
        this.AppiumDriver.FindElement(CommandRunnerBy).SendKeys("notepad" + Keys.Enter);
    }

    [Test]
    public void MoveToAndDoubleClick()
    {
        // Move to and double click windows search
        Actions builder = new Actions(this.AppiumDriver);
        IWebElement element = AppiumDriver.FindElement(MobileBy.Name("Type here to search"));
        builder.MoveToElement(element).DoubleClick().Build().Perform();
    }
}

See it working when Appium app not in the middle:

public class UsingWinDriverAndAppiumFourLib: BaseAppiumTest
{

    /// <summary>
    /// Setup Appium driver
    /// </summary>
    /// <returns>Appium driver</returns>
    protected override AppiumDriver<IWebElement> GetMobileDevice()
    {
        // Will need to start "C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" before running
        AppiumOptions options = new AppiumOptions();
        options.AddAdditionalCapability("app", "Root");

        // Connect directly to WinAppDriver
        return AppiumDriverFactory.GetWindowsDriver(new Uri("http://127.0.0.1:4723/"), options, TimeSpan.FromSeconds(30));
    }

    [Test]
    public void LauchFromRunner()
    {
        // Launch windows run
        new Actions(this.AppiumDriver).SendKeys(Keys.Command + "r" + Keys.Command).Build().Perform();
        By CommandRunnerBy = By.XPath("/Pane[@ClassName=\"#32769\"][@Name=\"Desktop 1\"]/Window[@ClassName=\"#32770\"][@Name=\"Run\"]/ComboBox[@ClassName=\"ComboBox\"][@Name=\"Open:\"]/Edit[@ClassName=\"Edit\"][@Name=\"Open:\"]");
        this.AppiumDriver.FindElement(CommandRunnerBy).SendKeys("notepad" + Keys.Enter);
    }

    [Test]
    public void MoveToAndDoubleClick()
    {
        // Move to and double click windows search
        Actions builder = new Actions(this.AppiumDriver);
        IWebElement element = AppiumDriver.FindElement(MobileBy.Name("Type here to search"));
        builder.MoveToElement(element).DoubleClick().Build().Perform();
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

Something like that, but it should be driver.executeScript