Desktop Application Automation With Robot Framework

Photo by Franck V. on Unsplash

A colleague of mine approached me and asked is it possible to use Robot Framework for automating desktop applications. I really haven’t ever considered using that for that purpose. There was some tutorial on YouTube that explained how to run & write automation for the Windows stock calculator. I decided to try to install the correct tools and write some simple test case. Let’s begin


List of packages to download from web

  • Python from here
  • wxPython2.8-win64-unicode- from here
  • AutoItLibrary from here
  • AutoIt Window Info Tool from here


First, we need to install Python. You have to install version 2.7.13 which you can get from here if you didn’t download it from the links above. I’m using the 64bit version on my setup. I recommend you install the python to the default location (C:\Python27). Also, remember to check Add python.exe to a path is selected to be installed. This adds Python to PATH variable so you can call it anywhere in cmd with python command. I had some problem with the installation and pip(Python package manager) didn’t get installed so i did have to install it manually by going to cmd and writing the following commands:

curl -o

After that you can check that it’s installed with command:

pip --version

You should get something like this:

pip 18.1 from c:\python27\lib\site-packages\pip (python 2.7)

You can also check that Python is correctly installed with command:

python --version


Next, we are going to install Pywin32. This package provides access to much of the Win32 API, the ability to create and use COM objects, and the Pythonwin environment. We can install it through the cmd using pip:

pip install pywin32


This package is needed for the RIDE to work correctly. You can get it with pip again:

pip install -U wxPython

We also have to install the windows executable version wxPython2.8-win64-unicode- If you didn’t download it from the link in the beginning you can get it from here.

Robot Framework

Then we also have to install the test automation framework.

pip install robotframework


RIDE is editor for the test data

pip install robotframework-ride


AutoItLibrary is a Robot Framework keyword library wrapper for the AutoIt Scripting Language.

pip install robotframework-autoitlibrary

We also have to extract the file. If you didn’t download it in the beginning you can get it from here. You can extract it anywhere. Now you have to open new cmd but this time you have to run the cmd as Administrator (right-click the cmd from the start menu and choose Run as administrator). Now navigate in the cmd to the folder you extracted previously and run:

python install

Automating first program

Now we got the boring part out of the way. You can now launch RIDE editor from cmd by typing:

After the RIDE is loaded go to File > New Project. Use these settings:

Now you should have screen like this:

Now we have to add the AutoItLibrary to the suite Libraries. Click Library > Browse. Now you have to navigate to the folder where libraries are. So I’m going to navigate to C:\Python\27\Lib\site-packages\AutoItLibrary. Here choose any file and click Open. You can also just type the library name to Name field and press Ok. I have sometimes countered some issues using just the name so i prefer to use the longer version. Now my Name field looks like this:


Now we have to trim the field value so its like this:


Now you can press Ok. A library is now added and the color of the text should be black. If its red then import failed. You can check clues from View > View RIDE Log.

Right-click your test suite name and select New Test Case. You can name it however you want I’m going to use first_test. Now your screen should look something like this:

You can save by pressing CTRL + S. Now navigate to Text Edit tab. Here we will be writing our code for the automation. Our test case looks like this when you open it:

If you want some syntax highlighting to your RIDE editor install this package and restart RIDE. I prefer just to make initial config in RIDE & after that write & edit my cases in VSCode and just run the cases in RIDE. Im also using the Robot Framework Intellisense extension to make VSCode recognize the language.

pip install pygments

Now let’s start writing our code. First, we have to pick our software that we are going to automate. I’m going to use Notepad++ for this tutorial. First, we are going to add a new section to the test called Variables. Inside Variables, we are going to define our first variable that defines the program we are going to run.

Here we have defined variable ${Notepad} which contains a path to the programs .exe file.

Now let’s write our first automation step. Here we are using keyword Run that is used to run the file. You can run EXE, BAT, COM, or PIF files with this command. Also, remember to indent the text after test case name. Also after the keyword, there should be 4 whitespaces between arguments.

After this we can open the Run tab select our test case from left menu and press Start button. If everything went fine Notepad++ should open. Our Run tab should look like this:

Now we need to install AutoIt Window Info tool. If you didn’t download it at the beginning you can download it from here. With this tool we can inspect the elements of the application and use it to target the correct elements. Open the AutoIt Windows Info program. It should look like this:

If you want to target the Notepad++ window you have to click the icon under the Finder Tool and drag & drop it to the window you want to inspect. Now as you can see I already did that on the screenshot. Now we can inspect the properties and values of the window. Let’s take the Title and use it in automation:

Now we added two new keywords to our automation case.

WinWaitActive this keyword waits until the window is active with title ‘new 1 — Notepad++’.

Send this keyword inputs text to the currently selected element.


So we managed to write a simple desktop application automation case. This article was meant for starting point using Robot Framework with AutoItLibrary to write desktop application automation cases. There is also /doc folder under the file where you can find more keywords. Also, you can find documentation from here.