Book demo
Start trial
Book demo
Start trial

The LEAP

Automation insights and productivity tips from LEAPWORK.

All Posts

How to Handle Image Comparison with Automation

Sometimes, user interface elements on screen can change size, color or shape depending on their state. For instance, a button might change from blue to green to signal something to the user.

In some situations, it might of course make sense to interact with the button only when it is green, and that can be done with a building block such as Click image.

However, there are other situations where the changes in state and visual appearance shouldn't impact test logic. For instance, if you want to double-click the Excel document shown below with a Click image block, it might not matter if the icon is unselected, selected or hovered by the mouse:

Image collections example with excel documents

In other situations, the same user interface element might be rendered very differently on regular HD and Retina resolution screens.

For all of these reasons, LEAPWORK now has built-in support for "image collections". An image collection is simply multiple representations of the same user interface element bundled together and understood as one.

One way to create an image collection is to capture a number of variations of the same image, as shown below:

Captured image collection images

Dragging one images onto another automatically creates an image collection which can then be named and expanded with more variations:

Image collection popup

Using image collections in your test cases is very simple; it works just like regular images. Just drag the image collection into a building block such as Click image and you are all set:

Image collection used in a case

When running this case, LEAPWORK will look for any and all of the images inside the image collection and click the first one found. If more than one is found, the "Use all occurrences" feature can be used to iterate through them.

Everything you need for codeless test automation

Learn more about codeless test automation in our guide to reducing risk, lowering costs, and driving value with test automation.

Read the LEAPWORK Guide to intelligent test automation

Claus Topholt
Claus Topholt
CTO and co-founder of LEAPWORK.

Related Posts

Comparison: Selenium IDE vs. LEAPWORK

Selenium IDE is a great open source tool for HTML-savvy users who want record and playback automation of simple web applications, but isn’t suitable for enterprises and has very limited functionality. This post compares Selenium IDE with LEAPWORK enterprise web automation.

Comparison: LEAPWORK vs. Selenium Web Automation

Selenium is a great tool for professional programmers who want to automate web applications, but for users who don’t (want to) write code, there are better options. This post compares code-based Selenium with LEAPWORK web automation. Side-by-side video comparison included.

Test Automation Frameworks: Why They Fail

Test automation frameworks are basically recipes for how to build automated test cases. They include guidelines for testers on how they should do their job. The problem is, these frameworks don’t always work, as they tend to complicate test automation more than necessary.