UI Test Automation on Windows Applications by WinAppDriver

If you ever wanted to automate your tests on Windows Applications, then you should try the first release of Windows Application Driver (WinAppDriver) which is released on October 19th, 2017. It is a service with functionalities defined by Appium. You can test Universal Windows Platform (UWP) and Classic Windows Forms (Win32) apps on Windows 10 PCs.

If you have experience with Selenium then it will be very easy for you. FindElementById, FindElementByName, and FindElementByXPath are some of the locators to find UI element in the driver’s application session.

Let’s install and run our first sample.

Installing and Running Windows Application Driver

  • Download latest release of Windows Application Driver
  • Install the driver on a Windows machine where you want to run your application under test

  • Open Start menu, write “Use developer features” and press Enter. This command will open Settings window of Windows 10 for developers. We need to change the mode to Developer in order to run the driver.

  • Chose Developer mode. It will ask you to be sure. Click Yes,

  • After installation of Developer Mode package, open Start menu again and write “cmd” and press Enter to open Command Prompt.
  • Write “cd C:\Program Files (x86)\Windows Application Driver” and press Enter to go to the installation directory of the driver on command prompt.
  • When you are in the installation directory write “WinAppDriver.exe” and press Enter to run the driver with its default settings. The result must be like this;

It means that Windows Application Driver is running and listening on the default IP address and port 4723. Now we can run our samples.

Running Sample Tests for WinAppDriver

You can find sample test scenarios written in various programming languages in the same repository https://github.com/Microsoft/WinAppDriver/tree/master/Samples

Java Samples

  • Open the sample folder as an existing project in a Java IDE such as IntelliJ. For example: CalculatorTest
  • In the Java IDE build and run the test

C# Samples

  • Pull the repo and open CalculatorTest.sln under CalculatorTest
  • In Visual Studio 2015 with the test solution open to building the test and select Test > Run > All Tests

For more information about the samples and how to write your own test project please visit http://en.otomatikmuhendis.com

4 thoughts on “UI Test Automation on Windows Applications by WinAppDriver”

  1. Hi Asif,

    I was keeping those details for another post but I can tell you that.

    Please, have a look at the WinAppDriver repository for the locators; https://github.com/Microsoft/WinAppDriver#supported-locators-to-find-ui-elements

    And Inspect tool for finding the properties of the elemts; https://msdn.microsoft.com/library/windows/desktop/dd318521(v=vs.85).aspx

    If this does not work, ask me anytime and I will be preparing the next post by the mean time.

    Reply
  2. Thank you for post. Couple of questions
    1. Does Appium support parallel execution for windows UI auomation thru winappdriver?
    2. Can we sideload Appium itself rather than enabling developer mode?

    Reply
  3. I have a Windows application that opens the main window, displays a splash screen, then opens a login dialog (after initialization). I am having trouble finding the various windows as they open and close. I keep getting the “CUrrenly selected window has been closed” error.

    When I ask var allWindowHandles = session.WindowHandles;I always get back either 1 or zero elements.

    Clearly I am not groking something. DO you know of sources where I can find examples of automation for this type of application? The Calculator example is great, but it only deals with a single window.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.