Welcome to the Ranorex Support Portal

Represent multiple elements with a single repository item

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.

In this chapter

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.


Further reading

Code modules are introduced in > Ranorex Studio expert > ⇢ Code modules.

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.

Gender selection radion buttons in 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:

  1. Open Ranorex Spy

  2. Start the demo application and click on the Test database register tab

  3. Track one of the gender selection radio buttons

Tracking of a radio button in demo application
  1. Tracked and identified female radio button UI element in the demo application

  2. Unique RanoreXPath specification for the female radio button in Ranorex Spy

  3. UI element browser tree displaying the defined path for the female radio button in Ranorex Spy

  4. 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.

  1. Change the RanoreXPath specification as shown here

Generalization of RanoreXPath specification
  1. Initial RanoreXPath specification that includes only the female radio button

  2. 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.

Multiple repository item tracking
  1. Positive match of two tracked radio buttons

Found elements information in Ranorex Spy
  1. 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.

Adding matched item to repository
  1. 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.

Renaming the generalized repository item
  1. Select the repository item representing multiple UI elements.

  2. Open the context menu to change the repository item name.



Get the latest test automation information right in your mailbox.


© 2024 Ranorex GmbH. All Rights Reserved