DESKTOP UI AUTOMATION - Lesson 1: Your first desktop UI automation flow

  • How to create desktop UI automation flows
  • How to easily capture elements in desktop applications
  • How to run desktop UI automation flows

Go to next video

You will learn:

  • How to create desktop UI automation flows
  • How to easily capture elements in desktop applications
  • How to run desktop UI automation flows

Go to next video

In this lesson you will get an introduction to Leaptest and learn how to create a new automation case and run it in preview mode.

We introduce the design canvas and the concept of building blocks for designing the automation cases. You will learn how to capture elements from Desktop applications and set values in field and click on buttons etc.


Welcome to the first lesson about desktop automation in LEAPWORK.

Desktop automation covers all applications running on a windows platform
like Word and Outlook, and it also covers applications built on
SAP, Java, Microsoft many other technologies.
It could be your CRM or Order handling system or any other front office or backoffice application.

In this video we will introduce the basics of LEAPWORK
and show you some examples of how to automate a desktop application.

The first automation flow looks like this:

- Show automation flow

When I run the flow, the LEAPWORK demo application is opening and we perform a login,
and end by verifying that the login was correct.

LEAPWORK ships with a demo desktop CRM application that we will use throughout the training lessons.
The demo application contains the most normal elements that you will find in a desktop application
including lists of data, search functionality and a form with different kind of fields.

You can use this to practise your LEAPWORK skills or try out different automations.

In the videos we are starting the application from an icon in the task bar,

So let me show you how you can add this easily.
I start by unpinning it from my task bar.

To add it to the task bar simply navigate to the LEAPWORK installation folder,
typically on the c-drive in the “program files” folder.
In the installation subfolder ”Studio”, find the DemoDesktop folder, where you can find and right-click the “LEAPWORK.DemoDesktop.exe” and click “Pin to taskbar”.
This will add a slightly different LEAPWORK icon - the L is red on a white background - to your taskbar for easy access to the demo app.

With the demo application added to the task bar - Let's start with the beginning!
Automation in LEAPWORK is centered around flows – so we’ll begin by creating a new one. You do this by simply clicking the blue New button and choose Flow.
A flow, aptly named “New flow” appears in the asset tree on the left. Note the blue highlighting – it’s ready for me to give it a name – I will enter “Desktop UI – Lesson 1”.
Automation flows in LEAPWORK are made up of building blocks, and we design and maintain the flows on the design canvas.
When we create a new flow, we only have one building block to start with: The Start building block.
We can move the building blocks around on the canvas, and we can zoom and center using the buttons in the lower right corner of the canvas.
We can also pan the canvas using the mouse, either by pressing down the spacebar or by clicking the pan icon in the lower right corner.
When we build a flow we start by pulling the connector on the start building block.
The connector is flexible and we can add the next building block wherever we want.
When I release the connector, the building block menu pops-up and shows all the categories of building blocks.

We can either open a category and select a building block or just start typing if we know the name of the building block.

In this case we will start with a Start Application Building block which is used for opening a desktop application.

Once it's added we can see a green arrow from the Start block to the Start Application block
which indicates the direction of the flow when the flow executes.
You can say the green arrow drives the execution of the flow.

In the Start Application building block we can either specify the name of the application,
the path to the application, but the easiest way is to capture the application that
we want to open.

I already have my LEAPWORK demo application running, so when I click capture
we can use the mouse to select this application. Once selected all details about the application
is captured back into the Start Application building block so it's now ready to execute.

We select "Close all windows" in the Start block to ensure that we have the same starting point for every run of
the flow and click on the Play icon. This will run the flow in preview mode.

As we can see the already open application was closed and a new instance opened.

When the demo application opens we get a login box, and we need to insert username and password.
To do this we add a "Set UI Element Value" block after the start application block.
This will find and set the value of a selected element - in this case the username field - when the flow is running.

To select the element I click "Capture new element".
LEAPWORK now minimises and the entire desktop is now in capture mode.
This means we can use the mouse to select the element we want to set a value in.
In this case I select the username field in the login box, which captures the field back into LEAPWORK.

We have a Text Value field where we can input the text we want to insert - in this case
the user "Test".

We do the same with the Password - the only difference is that we select the option "Password"
so the password is not in clear text inside the flow.

The final piece in the login is to click on the login button. I add a Click UI Element and capture
the login button.

Instead of re-running the entire flow to verify the logic, we can just right-click one of the building blocks
and select "Run flow from here". In this case the flow will attach itself to the already open application
and just execute from the selected building block. This makes it easy to do a stepwise, progressive design of
the flow, while constantly making sure that the functionality works as intended.

When the flow runs, we record a video of what goes on, so we now have a visual representation
of everything that happened. If I scrub the video we can see that the building blocks lights up
when they are active, and that the activity log in the right is also following the video.
These tools in combination makes it very easy to debug a flow.

Also be aware, that the default state of the flow is Failed, unless we explicitly
set the status to Pass, which I will show in a minute.

The last part of the login process is to verify that the login went well,
and I will do this by looking for an element on the screen that will only
appear if the login went well. In this case name of the logged in user
in the lower left corner of the main window.

I add a Find UI element, capture the user part and add a Pass block if we can find this element.

Let's run the entire flow from the start.

*** Run the flow

As we can see, the flow now passed.

In this video we introduced how you create and design flows for desktop automation in LEAPWORK.
We saw how to run and debug flows and how to open and capture desktop elements from applications.