Adding Repository Items

You can also add new items to your repository using Ranorex Spy tool. The following section describes how to add the 'Save' button which was not clicked during the recording session in order to automate a click on the button later on.

Firstly click the 'View Spy' button within the Ranorex Studio toolbar to open Ranorex Spy.

Open Ranorex Spy to track and to add items to the repository
Open Ranorex Spy to track and to add items to the repository
Secondly track the 'Save' button using the 'Track' button of Ranorex Spy.
Track and identify the 'Save' button with Ranorex Spy
Track and identify the 'Save' button with Ranorex Spy
Third add it to the repository as follows:
Add the item to the repository
Add the item to the repository
Newly created item in the repository
Newly created item in the repository

Now the 'Save' button is part of the repository and ready to be used by code or recording modules.

Create a new recording module to handle the 'Save' scenario. Use the 'Add New Action' drop down button at the toolbar and add a new 'Click' action. Finally connect the new action with the 'Save' button from the repository.
Execute the single action to simulate a click on the 'Save' button
Execute the single action to simulate a click on the 'Save' button
If the newly added click action was simulated correctly, a dialog is shown by the VIP application. You have to finish the save recording scenario with a click action on 'OK'. Therefore you need to track the dialog's 'OK' button, add it to the repository and finally add a new click action to the recording the same way you previously did for the 'Save' button.
Add tracked 'OK' button to the repository
Add tracked 'OK' button to the repository
'OK' button with application folder
'OK' button with application folder
By adding the 'OK' button to the repository a new application folder for the dialog with title 'Saving data ...' was created. Now extend the test case you created at the beginning of this tutorial with the 'SaveVip' module and run the test case.
Extend test case with 'SaveVip' module
Extend test case with 'SaveVip' module

One Repository Item For Multiple Elements

Repository items can not only be assigned to RanoreXPath expressions reflecting a single UI element. You can create a repository item using a RanoreXPath which delivers multiple UI elements too. Use the Ranorex Spy to prepare a RanoreXPath for a multiple result and add it to the repository as described in the previos section.
RanoreXPath delivering multiple results
Repository items delivering a list of elements are mainly used in code modules as described in the chapter Code Examples.