Book demo Start trial

Clicking on elements and text on screen

Watch this video to learn how to click images and text.

What you learn in this lesson

  • How to use the click image block
  • Change speed of the mouse
  • Adjusting the exact click position
  • Using the “Click text” block to find text and click it

Download apps: clicking-images-and-texts

Lesson Overview

Watch this video to learn how to click images and text.

What you learn in this lesson

  • How to use the click image block
  • Change speed of the mouse
  • Adjusting the exact click position
  • Using the “Click text” block to find text and click it

Download apps: clicking-images-and-texts

In this video I’ll show you how to click images and text when you create cases in Leaptest.

Clicking images and text obviously includes identifying the images and texts respectively. We have videos describing this in more details, but I’ll give a short intro for both image and texts, but will focus on the “clicking” part.

I have created 3 small demo web apps to help me demonstrate the features and the first one is for clicking an image.

  • Show demo app 1

It has an clicking icon, that will make a text appear when it’s clicked.

  • Click icon.

Like this.

  • Focus in Leaptest

First I will just click the image in the demo app using the default settings. I’ll start by adding a Click Image block to the Start building block.

  • Add Click Image

This block will search the screen – or the area specified – for the image that we add to it. We can add the image in 2 different ways: either by capturing a new image or by selecting it from the list of previously captured images.

In this case I will capture a new image – the click icon.

  • Capture the icon

Once captured it will be in the block and we can run the case.

  • Run case

When the case runs, and the click image block is executed, the screen is searched for the image specified. The engine will typically search the screen every 10th millisecond. When the image is found, the mouse is moved to the position and the image is clicked. In this case it’s left-clicking the icon in the demo app.

  • Expand Click Image

Expanding the Click Image building block reveals a number of properties and settings. The “button” property allows us to select which button to use for the click and whether it’s a single or a double click.

  • Point to Speed

Another setting is the speed of the mouse when it’s moving from the current position to the image found. Default is medium, which is about the same speed as most users. You can make it slower or faster or select “Instantaneous” which skips the mouse movement and simply just clicks on the image once it’s found. This can be used if you want to bring down the total time of a case, but be aware that you won’t see any hover effects in an application and you won’t see the movement of the mouse in the videos recorded.

Let’s try it.

  • Change Speed to Instantaneous
  • Run case

No mouse movement – just the clicking.

In some cases it makes sense to adjust the position where the image is clicked. This is typically the case if you want to set focus in a field and you want to identify the field by the label of the field.

To demonstrate this I have created another small application with only one label and one field.

  • Show demo app 2

When the field gets focused, the text will be selected.

  • Set focus in field

Like this.

I will capture a new image including the label and just the leftmost part of the field.

  • Capture the image

After capturing I will adjust the clicking position so that we are sure that the mouse will click in the field and thereby give focus to the field. Just click on the image and move the cross hair so it is inside the field – in this case all the way to the right.

  • Run case

As we can see, the image was found and the mouse clicked inside the field. This is a good example of setting or getting values from fields in both web and windows applications.

Instead of clicking just images we can use the “Click text” building block to find some text and click it. The building block uses Text Recognition just as the Find Text and Get Text building blocks.

I have yet another small demo app to demonstrate this

  • Show demo app 3

It’s just a text link, “Click me”, and when I click it, it will say “clicked” in the box below.

  • Focus back in Leaptest

I’ll add the text “Click me” in the “Text to click” field and run the case

  • Run case

The text was found and the link was clicked. Let’s try to change this to just “me”.

  • Run case

In this case, the engine found the word “me” as part of the URL, so the right link was not clicked. When working with all the Text Recognition base building blocks, it is best practice to set the area in the building block.

In this case we will set the area around the form to ensure finding the right “me”.

  • Set the area

When we set the area it will also have the positive side-effect, that the engine doesn’t have to search the entire screen for the word which increases the speed and accuracy.

  • Run case

Now we found the right instance of “me” and the link was clicked.

This ends this video demonstrating how to click images and text.