Most testers are familiar with Selenium WebDriver to automate Web applications. Many are also familiar Appium to automate Mobile apps. However, many are not familiar with automation tools. This post will focus on WinAppDriver, which is short for Windows Application Driver.
A while back, I wrote an article reviewing the benefits and drawbacks of 9 open source test automation tools for desktop apps. This post will focus on one that isn’t included in the list. It is relatively new, comes from Microsoft, and it makes perfect business sense to test Windows desktop applications using a tool that is from the same company.
WinAppDriver can be downloaded for free. However, the WinAppDriver source code is not currently open-source. However, they mention in their FAQs that they are looking into open-sourcing it. It supports Windows 10 (Home and Pro), Windows Server 2016 and Windows Server 2016. It also supports all Windows apps based on WinForms (Windows Forms), WPF, Windows Presentation Foundation, UWP (Universal Windows Platform) and the classic Win32.
It is a powerful tool that excels in the field of automation for desktop apps.
- It’s completely free
- It was developed by Microsoft
- It uses WebDriver protocol, which is the most important.
What does this all mean? It means that if your background is in web/mobile and you are familiar with how to use the WebDriver environment to develop, the transition to WinAppDriver should be simple, quick and easy. We will use the same techniques as in the WebDriver environment. WinAppDriver will identify elements using findElement.
WinAppDriver is a standalone program that can be used in conjunction with Appium. If you have Appium’s server running, then a request to Win10 app automation will launch WinAppDriver.exe.
Setting up the WinAppDriver Environment
We will need to follow a few steps in order to use WinAppDriver.
- Initial setup is Download and install WinAppDriver from: https://github.com/Microsoft/WinAppDriver/releases (you need to choose the file: WindowsApplicationDriver.msi). It is a straightforward “next-next” installation.
- Allow “Developer Mode”, in our operating system Win10. Let’s go to the Settings menu and select Update & Settings. Next, click on “For Developers”. As seen in the below image:
- Install Windows SDK. We will need inspect.exe to identify the elements of our Desktop application. This tool is included in the Windows SDK package that we will install.
We will configure the appropriate libraries in the Nuget Package Manager (with Visual Studio).
Inspect will be used to identify UI elements in the application being tested. In this example, I have opened Sticky Notes and tried to identify these elements with Inspect.
WinAppDriver allows you to use many programming languages. In this case, I chose to use Nunit and C#. Here is the code that I used to launch the session from Sticky Notes.
public void TestInit()
var appCapabilities = new DesiredCapabilities();
driver = new WindowsDriver(new Uri(“http://127.0.0.1:4723”), appCapabilities);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
This code example shows how I used the driver object of WindowsDriver class to access the RemoteWebDriver class. The screenshot below shows the hierarchy.
Once we have reached the stage of initiating the driver we will need to go to the local address (in this example) using port 4723. This is Appium Server’s default port. Once our driver is initiated, we can begin working with it to execute WebDriver protocols.
public void Test01()
public void TestCleanup()
- It is open-source and uses the web driver protocol.
- It is completely free and was developed by Microsoft.
- WinAppDriver integrates with Appium and selenium projects in the same language.
- WinAppDriver supports any programming language.
- To locate UI elements, you can use Xpath or other properties.
Cons of WindowsAppDriver:
- It does not support all operating systems. It only supports Windows 10, not macOS, or Linux.
- It does not have a playback or record option.
- There is no built-in support to integrate ALM.
There are many automation tools available for Windows applications. These include selenium, which can be used with all browsers, including Firefox, Chrome, and Firefox. Selenium is best for web applications. Appium, however, can be used to test Android/iOS apps.
Selenium offers many options for testing desktop apps. However, the Winium desktop test solution allows you to automate all types of desktop applications. Winium runs on JSONWire protocol, which Selenium uses. It can be used to inspect window-based applications elements and for desktop automation.