Waiting for UI Elements
KeePass application opening a new database from a URL
Open properties of 'LoginWindow' application folder
Test case execution failed - 'LoginWindow' was not found within the specified timeout of 10ms
Note In order to restore your repository into a working condition, reset the search timeout value for the login dialog to 30 seconds.
Waiting for a Particular UI Element State using the WaitFor Action
It's often necessary or sensible to wait for the state of a UI item (e.g. its text) to change during test execution. You can easily accomplish this using the WaitFor action. Consider the following case in KeePass:
To demonstrate the functionality the WaitFor action, create a new test case (e.g. 'ClipBoardTestCase') containing the recording modules 'StartSUT', 'Login', 'SaveDB', and 'CloseSUT'. Now add two more recording modules after 'Login'.
Insert two new recording modules after the 'LogIn' recording
Name the first module 'CopyPassword' and record the procedure of right-clicking on an entry in KeePass and clicking 'Copy Password'.
Name the second module 'WaitForReady' and follow these steps to add the required actions to the recording:
- Confirm that KeePass is in a suitable state (opened, logged in, containing at least one entry).
- Open the recording module and click the 'Track...' button.
- Select the status text 'Ready.' at the bottom of the KeePass application. A repository item will be created and automatically selected.
- Drag this repository item to the action table and from the context menu that appears, select 'Wait For'.
- Select 'AttributeEqual' from the drop-down menu in the third column.
- Select 'Text' from the drop-down menu in the 'Match Name' column.
- Click on the action and press F4 to bring up its properties.
- Set the WaitTimeout to 13 seconds. We know that KeePass takes 12 seconds to remove the password from the clipboard, so that's the time we need to wait.
You can now run the test and you will see that Ranorex waits 13 seconds after the CopyPassword module to validate that the text in the status bar is 'Ready.'.