Test Automation for Windows Desktop Applications using Winium


Winium – Making Test Automation Faster & Better

Automation plays a significant role to achieve product quality success and deliver it on time. You need to follow this specific path: initially invent a solution to test problems, discover a long-term and cost-effective solution, and make a comprehensive coverage against requirements.

You can  successfully carry out test automation for when you have a requirement for automating Windows Desktop Application. Initially, if you think of using Sikuli for the automation and feel the need to take the screenshot of all the objects, you will realize that it’s very difficult to manage the dynamic objects in the application. But with the Winium tool, there no need to use a screenshot of the objects; you can use as Selenium based locators like name, id and class. Winium helps you to automate faster and deliver on time.

You have Selenium WebDriver for testing of web apps and Appium for testing of iOS and Android apps. Winium is introduced to testing of Windows apps and it is a Selenium-based tool. You are able to write tests with your favorite Dev tools using any WebDriver-compatible language such as Java, JavaScript with Node.js, PHP, Python, Ruby, C with the Selenium WebDriver API and language-specific client libraries.

There are different automation tools and frameworks which are available for windows applications like Sikuli, AutoIt, Winium etc. These tools used for desktop application (windows) automation for testing have their pros and cons.

Among all of them, Winium is the most convenient and popular automation framework for desktop application. Winium is Selenium Remote WebDriver implementation for automated testing of Windows application, based on WinFroms and WPF platforms. Following are the details of a POC with Winium:

Prerequisites of Winium

  • Install Microsoft .NET Framework 4.5.1
  • Create Maven Project and add following dependencies in pom.xml file
    • selenium-java
    • selenium-server
    • winium-elements-desktop
    • winium-webdriver

    Here, is the identification of notepad.exe for automation.

    How to Create a Winium Driver Session?

    WebDriver driver = null;
    String notepadApplicationPath = “C:\\Windows\\System32\\notepad.exe”;
    String winiumDriverPath = “D:\\SeleniumDrivers\\Winium.Desktop.Driver.exe”;// To stop winium desktop driver
    before start another session
    Process process = Runtime.getRuntime().exec(“taskkill /F /IM Winium.Desktop.Driver.exe”);
    DesktopOptions options = new DesktopOptions(); // Initiate Winium Desktop Options
    options.setApplicationPath(notepadApplicationPath); // Set notepad application path
    WiniumDriverService service = new WiniumDriverService.Builder().usingDriverExecutable(new
    service.start(); // Build and Start a Winium Driver service
    driver = new WiniumDriver(service, options); // Start a winium driver

    Once you get the driver you can start your automation scripts like selenium scripting,

    driver.findElement(By.className(“Edit”)).sendKeys(“Welcome to Winium”);
    driver.findElement(By.name(“File name:”)).sendKeys(“NewFile”);

    Key Winnium Pointers to Consider

    Process process = Runtime.getRuntime().exec(“taskkill /F /IM Winium.Desktop.Driver.exe”);

    Automation initiatives enable enterprises to create a wave of digital transformation. With Winium, automation is simplified for Windows Desktop Application. Winium is undoubtedly, the most handy tool for automating windows application as it is Selenium based. People who are much familiar with Selenium based commands find it quite easy to work with Winium. It is also, pretty fast compared to other tools. Open source applications enable you to modify the framework in any way that you want. There are unlimited possibilities to enhance the script with Winium.

    If you want to learn more about our testing and test automation services and solutions, please

    contact us here

    Sanoj S
    Test Architect, RapidValue


    1. Kavitha J says:


      I would need your help.I am currently automating our desktop application using winium.
      I am using UISPy tool to capture the objects of my desktop application.
      I came across a situation where there is a properties panel which has different attributes based on tree item.
      I am able to access the properties panel window when I try for the first time,The window (UISpy) doesnt get automatically refreshed when I select a different tree element.On refreshing the windows , I am able to view the current attributes of the selected tree element.
      But I dont find a way to refresh the windows element from my python code.
      Could you please help ?

      Thank you!

    2. Shikha says:

      Can winium support remote desktop application automation. My application is on server which need to be automated.

      Please provide the link for the same.

    3. Sanoj says:

      @Shikha, Winium is a traditional concept, latest Appium support to automation desktop applications in both Windows and MAC. You need to set the desired capabilities for that,

      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability(“app”, “YOUR_APPLICATION_PATH”);
      capabilities.setCapability(“platformName”, “Windows”);//For MAC desktop the value should be Mac
      capabilities.setCapability(“deviceName”, “WindowsPC”);//For MAC desktop the value should be Mac
      driver = new WindowsDriver(new URL(“”), capabilities);

      In your case, the Appium server should run in the remote system where the application installed. You need to start the appium server in the remote system with that system’s IP. The same IP you need to mention in the URL section instead of

    4. Vishaka says:

      Doing my desktop automation using Winium. The automation works fine until there is no disturbance like mouse clicking/keyboard pressing. It doesnt work when I minimize the remote server or do anything using the mouse. Please provide possible solution to overcome this. Thanks.

    5. Sanoj says:

      Hi Vishaka,

      As per the Winium or WinAppDriver concept, they are using inspect UI tree mechanism to traverse through elements. So the application should run the foreground. They strict to UI visibility means UI components should be in the foreground not like Web application interactions. You can extend your screen and try to run script on that screen to avoid the interruptions or you can set a server system only for execution purposes.


    6. Vishaka says:

      Hi Sanoj,
      Thank you for the elaborate answer. Does that mean, it is not possible to automate desktop application with the desktop being inactive(or we cannot do any other operations in that machine?)

    7. Krishna says:

      How to Create a Batch run for Winium Test ?

    8. Sanoj says:

      Hi Vishaka,

      No issue with when your desktop inactive but make sure that your Windows AUT should be up and running in the foreground.


    9. Sanoj says:

      Hi Krishna,

      This is an out of the box question, but I would like to share some point here. If you are using testng.xml then map all your test classes in the testng.xml. Create a batch file and configure the path of testng.xml in the batch file, later execute the batch file alone to trigger the test scripts. Make sure that your appium server up and running to listen to your action requests from the client-side (application).


    10. Deepa says:

      How to get the title name of opened windows application using winium c#

    11. Sanoj says:

      Hi Deepa,

      If you are using Winium.Desktop.Driver.exe to create session and driver.getTitle() will not work because they are not implemented to support it. As per the modern concept of Appium, they introduced WinAppDriver, a couple of differences when compared with the old method.
      1. Need some additional desired capabilities.
      2. Need to start the Appium server no need to pass the path of Winium.Desktop.Driver.exe. WinAppDriver also supports MAC OS applications.

      If you are using the WinAppDriver concept, you can use driver.getTitle() to get the title of your desktop applications. Below are some sample snippet,

      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability(“app”, “C:\\Windows\\System32\\notepad.exe”);
      capabilities.setCapability(“platformName”, “Windows”);
      capabilities.setCapability(“deviceName”, “WindowsPC”);
      driver = new WindowsDriver(new URL(“”), capabilities);


    12. Subbarao says:

      Does winium support for automating putty commands?

    13. Sanoj says:

      Hi Subbarao,

      If you have the Putty executable and try to use WinAppDriver to perform the UI level actions after opening the Putty window. Alternatively, you can use the Robot class. The Robot class makes it possible for your Java program to work with Putty and all.


    Please Share Your Thoughts & Comments Below.

    How can we help you?