We're here to help
UI handle alert
This test step responds to a UI alert dialog which appears after a UI operation has been performed and needs handling to proceed further. This is useful for handling standard alert, confirmation or error messages appearing on certain Salesforce operations such as deleting records.
This test step can be added when mapping an alert through the Test Builder.
It can also be added via the Test Palette by locating the test step and dragging it into the test case.
Update the following parameters:
- Expected Message: Exact text of the UI alert to be handled (case sensitive)
- Response: The response to the Alert, e.g. OK, Cancel
Refer to Managing test steps for more information on updating Wait and Screenshot Options.
Then save the test case.
Note: Multiple alerts can be configured on the same test step. This is useful if different alerts have been configured on a single operation based on the business flow. In such cases, Provar simply matches the text on the alert which appears and performs the configured operation.
This example illustrates the usage of the UI Handle Alert test step to cancel or confirm the deletion of an Account record in Salesforce.
Step 1: Create a test case and launch the Test Builder. From the ‘All Accounts’ list view, locate the ‘Delete’ link on the first row of Account data in the list view. Right click on this link and select ‘Add to Test Case’, then select ‘Add & Do’ on the draft Test Step.
Step 2: When the Salesforce alert appears asking for confirmation, click on Handle a Browser Alert on the Test Builder:
Step 3: Enter the text in the Expected Message field on the Test Builder as it appears on the alert and choose the option to ‘Cancel’. Then click the Add & Do button.
Note that the Account has not been deleted:
Step 4: Repeat the above steps to re-attempt deletion and bring up the same UI alert. This time choose the option to click ‘OK’ and then select Add & Do.
Note that this time the account has been deleted.