Automated Windows UI testing by Jest + selenium-appium + selenium-webdriver + WinAppDriver

Canhua Li
2 min readAug 26, 2019

I was working on choosing a JS friendly UI automation framework for React Native on Windows, and the first solution jumped into mind is Detox. After sometime I dropped this solution because there is no existing public ‘Gray box’ library for UWP apps just like EarlGrey for iOS. Then I fall backed to Appium+WinAppDriver solution. There are two popular WebDrivers: WebDriverIO and selenium-webdriver. Both WebDriverIO(see description in PR 4369) and selenium-webdriver(PR 7505) have problem to be integrated with WinAppDriver. Hereafter I only talk about selenium-webdriver.

Microsoft recommend using Selenium for testing web apps and Appium with WinAppDriver for testing desktop and UWP apps.

WinAppDriver supports testing Universal Windows Platform (UWP), Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Classic Windows (Win32) apps on Windows 10 PCs.

selenium-webdriver is the official WebDriver JavaScript binding from selenium project. But it doesn’t implement Mobile JSON Wire Protocol Specification, so it doesn’t supports WinAppDriver.

Selenium is a large community, and the API is familar to a lot of people. So I create selenium-appium to make selenium-webdriver capable of automation with WinAppDriver, and it provides:

  1. Supports mobile JSON Wire Locator from By2
  2. Typescript
  3. PageObject pattern and handy feature like Locator and waitForPageLoaded. Instead of using webDriver.wait first and then click, it’s been consolidated to the locator By2.click.
await By2.nativeName(‘One’).click();

For calculator example of using selenium-webdriver+WinAppDriver on Windows, please refer to example

For more about this, please refer to selenium-appium project

--

--