Graphical user interface elements (i.e. UI elements) are the graphical elements on a computer screen that represent stored information within computers and allow users to interact with the software. Common examples are windows, text fields, buttons, labels, lists, selection elements.
Because Ranorex Studio is a tool for automated GUI testing, it needs to be able to reliably identify UI elements for use in the tests you create. In this chapter, we’ll explain how this works.
In this chapter
This chapter covers an advanced topic that is closely connected to Ranorex Spy and RanoreXPath. Together, they explain how UI element identification in Ranorex Studio works. We therefore recommend you also study these chapters.
RanoreXPath is explained in:
Ranorex Studio advanced > ⇢ RanoreXPath.
RanoreXPath is explained in:
Ranorex Studio advanced > ⇢ Ranorex Spy.
Let’s first take a look at how we as humans identify UI elements. For us, the process is usually quite intuitive.
Take the start page of the Ranorex Studio demo application, for example:
Tabs for different panels
Text label showing a welcome message
Text field for entering a name
Text link for resetting the welcome message
Exit button for closing the application
To better understand the challenge of reliable UI element identification, let’s take a look at one particular UI element, the text input field.
How do you know that the framed UI element is a text input field?
Possible answers may be:
All of these are good indicators, and if the field accepts text entry, you can be quite certain that it’s a text input field. However, unless you have access to the software’s code, you can’t tell with absolute certainty what the UI element does in detail. Instead, you have to rely on context-based clues and your general idea of what a text input field does, i.e. an “inner representation” of the UI element.
As an application, Ranorex Studio doesn’t have access to indicators like user guide information, being shown by others, or human intuition. Its approach is based on hooking into an AUT, detecting which technology is used for the GUI, and then identifying UI elements and categorizing them according to ⇢ roles, capabilities, etc.
However, in some ways, Ranorex Studio works in a very similar way to human UI element identification: It also generates “inner representations” of UI elements, called repository items. These have a unique identifier assigned to them, the RanoreXPath, that locates the respective UI element in the GUI structure of the software. This is a two-step process:
UI elements in the GUI of the AUT
Representation of these UI elements
Important to know:
The UI elements in an AUT are organized in a certain structure. When Ranorex Studio scans a GUI to identify UI elements in it, it translates this structure into a hierarchical element tree that you can see in ⇢ Ranorex Spy. The animation below illustrates this:
The above example is simplified for explanation purposes. The full hierarchical tree would look like this in Ranorex Spy: