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 API can be added when mapping an alert through the Test Builder.
It can also be added via the API palette by locating the API and clicking 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 API UI Handle Alert 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.