In the action logic, you can handle browser alerts using commands listed below. Browser alerts prevent access to the elements on the page. So, it is important to handle alerts in your test logic to unblock interaction.
Note: Some times, it may take a few seconds before an alert dialog appears on the screen. Insert a few seconds (about 5 sec) wait time before using one of the commands below.
Handle Alert Dialog | Handles browser alert dialog either by clicking Accept or Reject. |
Click and Accept Alert | Clicks a given element on the screen, and conditionally accepts any alert that may have popped up. This is suitable in case the alert is only conditionally displayed based on the environment or other conditions. |
Click and Dismiss Alert | Clicks a given element on the screen, and conditionally rejects any alert that may have popped up. This is suitable in case the alert is only conditionally displayed based on the environment or other conditions. |
Get Browser Alert Message | Reads the message displayed in the alert dialog. |
Verify Browser Alert Message | Verifies if the message displayed on the alert dialog is as expected. |
Is Browser Alert Message | Used for conditional validations. Returns true/false depending on a matching alert message. |
Comments
0 comments
Please sign in to leave a comment.