great place to work

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(“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.


    14. jose Manuel Orjuela says:


      I have a question … When I finish automating my application, how can I integrate this to Jenkins or others?

      I think it can be done using the Pom.xml, but I don’t see any tutorial on the internet.

      please help me.

    15. Sanoj says:

      Hi Jose,

      You can map testng.xml at build tag section of pom.xml like:



      You need to create the repository in Git/Gilab/Bitbucket after that you create a freestyle project in Jenkins and map the project repository in Jenkins. At build section, you can provide goal say mvn clean test.

    16. sibi says:

      hi Sanoj,

      how to handle new dialog pages in desktop automation using winium.

      I had like this type of error is happened how can I handle this.

      Exception in thread “main” org.openqa.selenium.NoSuchElementException: Element cannot be found (WARNING: The server did not provide any stacktrace information)
      Command duration or timeout: 229.21 seconds
      For documentation on this error, please visit:
      Build info: version: ‘2.48.2’, revision: ’41bccdd10cf2c0560f637404c2d96164b67d9d67′, time: ‘2015-10-09 13:08:06’
      System info: host: ‘SIBI’, ip: ‘’, ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_281’
      Driver info: org.openqa.selenium.winium.WiniumDriver
      Capabilities [{app=C:\Users\Admin\Downloads\vlc-3.0.12-win64.exe, args=, innerPort=9998, debugConnectToRunningApp=false, keyboardSimulator=1, launchDelay=0, platform=ANY}]
      Session ID: AwesomeSession
      *** Element info: {Using=id, value=01000080CA070100FCFFFFFF00000000}
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(
      at org.openqa.selenium.remote.RemoteWebDriver.execute(
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(
      at org.openqa.selenium.remote.RemoteWebDriver.findElementById(
      at org.openqa.selenium.By$ById.findElement(
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(
      at testing.Installation.main(

    17. Sanoj says:

      Hi Sibi,

      It seems your driver session server can not able to find the objects from the popup window. You can do multiple ways to handle it. Make sure that you captured right object value (Id, ClassName like that) using Inspect.exe or any other windows application inspector. Secondly, you can add some wait before doing action on new pop up window (try implicit first better go with explicit wait). Another method you can use Sikuli library to perform the action on the object based on images. This issue not related to Winium driver or its sessions.


    18. sibi says:

      how to run as administrator in windows using winium and also how to perform right click.

    19. Tommy says:

      Hi Sibi,
      I’m also facing the same issue previously, literally I have no idea how to launch an application with Administrator Privileges !
      If you have any idea about that please share your solution @Sanoj.


    20. Sanoj says:

      Hi Sibi and Tommy,

      To launch an application with Administrator Privileges, please try below code snippet:

      public static DesktopOptions options = new DesktopOptions { ApplicationPath = @”runas /user:administrator”, Arguments = @”your_app_path” };

      To perform right click. Try below code snippet:

      new Actions(driver).contextClick(element).build().perform();


    21. Gopi says:

      I am doing both web browser(selenium) and desktop application automation ( using winium) in same test. First doing browser activities, then want to do desktop application activities. After browser activities completed, desktop application driver not working. Here winium driver not doing anything just staying for long time. And failing.

      Any idea on this?


    22. Sanoj says:

      Hi Gopi,

      If you are starting both Selenium and Winium sessions parallel then you may need to increase the Appium timeout time to complete the selenium session otherwise session may hang and exit. If Winium still active even after the Selenium session complete then your application should be in the foreground, then only Winium will perform the action. You can also manage these sessions by using different test tags in testng.xml first one for selenium and the second for Winium, also make the suite parallel=”none”; in this case selenium will execute first once it complete Winium will start the session and it will perform the operation of Windows application.


    23. Mahendra says:

      I’m working on one of application where I need to take screenshot of win app(e.g Notepad). I got what I want using winium but the problem is if the application is minimize it take the screen shot of currently active or Open window.
      Anther problem which I faced, is I just add script to click on format option of notepad and while running the script I switched from notepad to other application and the script is click on that application rather than notepad.
      so is there any solution for same or please suggest if I’m following any wrong practice.

    24. Sanoj says:

      Hi Mahendra,

      To take screenshot I usually use following function:

      final File file = ((TakesScreenshot) new Augmenter().augment(driver)).getScreenshotAs(OutputType.FILE);
      FileUtils.copyFile(file, new File(“D://test.png”));
      This code working as expected. Below is the code I used,

      driver.findElement(By.className(“Edit”)).sendKeys(“This is a sample note from sanoj to Notepad”);
      final File file = ((TakesScreenshot) new Augmenter().augment(driver)).getScreenshotAs(OutputType.FILE);
      FileUtils.copyFile(file, new File(“D://test.png”));
      You will get a screenshot of the Notepad editor with contents.

      The other issue you mentioned about click on the Format. In the case of Windows application automation, your AUT should be in the foreground during the execution. Here, we are using the Appium server looking for DOM of Widows as a whole, not like selenium web app DOM. So if the Format option present on other applications also Appium will perform the operation.

    Please Share Your Thoughts & Comments Below.

    How can we help you?