There are times when it may be helpful to have a single repository item represent multiple UI elements. Examples include elements such as radio buttons and checkboxes. This feature is commonly used with code modules.
Necessary context
The concept covered in this chapter is often used with code modules, which is an expert topic. In addition, you will find the example easier to understand if you are familiar with the RanoreXPath syntax and the Ranorex Spy tool. Use the links below to learn more about these advanced topics.
- Code modules. Code modules are introduced in Ranorex Studio expert >
- The RanoreXPath syntax is described in Ranorex Studio advanced > RanoreXPath.
- Learn about the Ranorex Spy tool in Ranorex Studio advanced > Ranorex Spy.
Example definition
In the following example, one repository item represents two radio buttons. These radio buttons appear within the gender selection region of the database in the demo application.
Track the repository item
The procedure for creating a repository item to represent multiple elements is the same as for a regular repository item. Refer to the instructions below:
-
Open Ranorex Spy
-
Start the demo application and click the Test database register tab
-
Track one of the gender selection radio buttons
-
Tracked and identified female radio button UI element in the demo application
-
Unique RanoreXPath specification for the female radio button in Ranorex Spy
-
UI element browser tree displaying the defined path for the female radio button in Ranorex Spy
-
Path editor for the female radio button in Ranorex Spy
Generalize the RanoreXPath specification
Follow the steps below to generalize the RanoreXPath specification so that it includes the second gender selection radio button of the demo application.
Change the RanoreXPath specification as shown in the image below:
-
Initial RanoreXPath specification that includes only the female radio button
-
Modified, generalized RanoreXPath specification that includes both radio buttons
Multiple repository items detection
Generalizing the RanoreXPath specification leads to the simultaneous tracking of both gender selection radio buttons in the demo application. This can be seen in Ranorex Spy.
-
Positive match of two tracked radio buttons
-
Ranorex Spy displays the match result in the lower left corner of the working environment
Add the tracked item to the repository
Finally, add the matched items to the repository.
-
Select one of the matched repository items, open the context menu, and click Add to repository
Name the generalized repository item
Like all repository items, the generalized repository item can be renamed to be more meaningful.
-
Select the repository item representing multiple UI elements.
-
Open the context menu to change the repository item name.