The Invoke action allows you to perform an action on a repository item without any direct interaction like mouse clicks or keyboard input. This is particularly useful for manipulating UI elements that aren’t visible, such as windows that are out of focus or list items to which you need to scroll. In this chapter, you’ll learn how to use the Invoke action through two examples.
In this chapter
The screencast “Invoke action” walks you through information found in this chapter.
Simple button click
In this example, you’ll perform a simple button click with an Invoke action. Action #1 in the image below performs a mouse click on the Add entry button of the AUT.
Mouse click action on Add entry button
To replace it with an Invoke action that does the same: Click Add new action > Invoke action.
An empty Invoke action appears in the actions table.
Add an Invoke action
From the repository, drag the item BtnAddPerson that represents the Add entry button to the Invoke action.
Link repository item to Invoke action
In the Action name column of the Invoke action, select PerformClick().
Specifying invoke action type
Finally, right-click the regular Mouse click action and click Disable to disable it.
- The click on the Add entry button is now executed directly without any mouse interaction.
List item selection
Automating list item selection can be challenging because often, certain items won’t immediately be visible. Using an Invoke action instead of a regular mouse interaction can often make your test more robust. The image below shows a standard list item selection using Mouse click actions.
List item selection
Mouse click action that opens the Department drop-down.
Mouse click action that selects Project Management from the list items.
To perform this with an Invoke action instead: Click Add action > Invoke action twice to add two empty Invoke actions.
From the repository, drag the item Open representing the drop-down button to the first Invoke action. Repeat for the second Invoke action with the item ProjectManagement representing the Project Management list item.
In the Action name column of the first Invoke action, select Press (). Repeat for the second Invoke action with Select (). Finally, right-click the regular Mouse click actions and click Disable to disable them.
Invoke action for list item selection
- The list item selection is now executed directly without any mouse interaction.