UI Handle Alert
This API 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 clickingg 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 Common Test Step Parameters 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.