How to Automate a Desktop Application? - ByteScout
  • Home
  • /
  • Blog
  • /
  • How to Automate a Desktop Application?

How to Automate a Desktop Application?

There are various automation tools available to automate the application but very few for the desktop application. If you google then you will find a few open-source tools for various operating systems such as Windows, MAC, and Linux.

Here are some tools:

  1. WinAppDriver: Also known as Windows Application Driver is a tool that supports Selenium UI Test Automation on Windows desktop Applications. It is created by Microsoft as an open-source project and it works only on Windows 10. In this article, you will learn how to automate the desktop application using WinAppDriver.
  2. FlaUI: It is a. NET library which allows users to automate UI testing of Windows applications such as Win32, WinForms, WPF, and much more. It covers almost everything such as UI Automation libraries but also gives the inherited objects for particular requirements.
  3. Winium Desktop: Winium is a Selenium-based tool. It is used for investigation and automation of the Windows desktop application. This tool is simple to use for those who know how Selenium works.
  4. Sikulix: SikuliX supports desktop computers running Windows, Mac, or some Linux/Unix. This tool can be used to automate desktop or web applications despite any technology. It is based on Java and beneficial when there is no simple access to an internal or source code.
  5. Robot Framework: It is a general test automation framework for approval testing and recognition test-driven improvement. This framework is open-source and based on Java. It is a keyword-driven framework that utilizes tabular data syntax.

In this article, you will learn how desktop applications can be automated using WinAppDriver.

Automate Desktop Applications

Install Windows Application Driver

The first step is to install the windows application driver. As mentioned earlier, the WinAppDriver operates on Windows 10. It requires any Appium test runner. So, first, go to Github and download Windows Application Driver installer from https://github.com/Microsoft/WinAppDriver/releases and then run the installer on a Windows 10 computer. Make sure that you run this installer where your application exists and will be tested. Finally, enable Developer Mode in Windows settings as shown in the figure. After this, just run the application, by simply starting WinAppDriver.exe from its installation folder.

Automate Desktop App

Windows Application Driver will then be running on the test machine listening to requests on the default IP address and port (127.0.0.1:4723). You can now run any Tests or Samples. WinAppDriver.exe can be configured to listen to a different IP address and port as follows.

Now, Windows Application Driver will then listen to all the requests on the default IP address and port on the test computer. Users can now run any Samples here. In this manner, the .exe can be configured to listen to various IP addresses and ports. These are the prerequisites for the WinAppDriver. Now, in this article, we will try to automate by using one invoice PDF file as shown in the below figure.

Automate Desktop Application

The invoice contains various data such as invoice number, address, date, and amount. Now we will collect all this information by using the .exe file and we will read all the collected information. For this, we will invoke the executable file and fill all the information such as invoice number, address, date, and amount in the form and submit. To accomplish this task, we will also use the ByteScout PDF parser SDK called Document Parser SDK.

Automation Process

Now, the following image is displaying the project structure. For example, in the right-side panel, you can see two files invoice.pdf and invoice.yml. YAML file is used widely for its configuration files, designs, and page settings. It is a human-readable data file that is used to describe data.

After reading the data from the PDF file it will be inserted into the form displayed below. To do this, the first step is to download the ByteScout Document Parser SDK. We will use the document parser SDK tool from the kit.

How to Automate Desktop App

After installing the ByteScout Document Parser SDK, open the template editor and load the saved YML file and the sample file in this template editor.

How to Automate Desktop Application

Here all the recorded fields such as bill name, bill amount, invoice number, and invoice date will appear under the Template fields and when you click the test template button. It will generate the results in the different file formats as displayed below.

Automation of Desktop Apps

For this project, we are going to use the JSON format as displayed in the above figure. Now, we have the invoice PDF and the YML file. Here we will use the invoice PDF and the YML file along with the executable path where the .exe file is located. There are two parts to this project. For the first part, we will get all the invoice data by using the input file and the input template so that it will return the data in the invoice format containing all the fields. In the second part, we will use the document parser to get the output in the JSON format.

Automating the entry

Now, after getting all the files and document parser, in this section, we will now automate the entry by starting the WinappDriver server and providing the executable path.

Automation of Desktop Applications

Now, as displayed in the figure below, we will invoke the session and set the sendkeys parameter. Here, you will find elements by accessibility ID of the invoice data.

Desktop App Automation

The next step is to inspect the UI element. Now, once you fill all the data into the form, it will automatically generate the automation ID in the inspect element window. This utility is very useful for automating the desktop application.

Desktop Application Automation

Now, after building the solution, just click on the start button. After clicking the start button, it will automatically record all the data from the PDF such as invoice date, address, amount into the form.

Automation of Desktop App

In this way, with the help of the WinAppDriver and ByteScout Document Parser SDK, the desktop application can be automated swiftly. This is a step by step method and all the data will be fetched by using the keys mentioned as parameters.

 

Check this video for a detailed tutorial:

prev
next