How to record pop-up boxes using Test Recorder?

QAS now provides the commands to capture and interact with all three kinds of popup boxes that are, Alert box, Confirm box, and Prompt box. Follow the mentioned steps to see all the three examples below:

  • In your Test Recorder, create a Test Suite and add a Test Case.

  • Click on ‘Record’ and provide the testing website’s URL, for example, https://www.seleniumeasy.com/test/javascript-alert-box-demo.html.

  • Now start recording and perform the required steps to capture the Alert popup boxes.

  • Stop the recording and Navigate back to the Test Recorder.

  • On the recorded steps you would require to insert the following commands based on your testing scenarios:

    • Get Alert Text: This method is used to stores alert text to a variable which can then be used in subsequent test steps for verifications and assertions.

    • Accept Alert: This command is used to click on the 'Ok' button of the alert.

       

    • Dismiss Alert: This command is used to click on the 'Cancel' button of the alert.

       

    • Set Alert Text: Simulate users typing text into a prompt popup.

    • Implicit Wait: Insert this command when you have an estimation about the time taken by all web elements on the web page to load/visible. The time is provided in milliseconds.

  • Below is a sample screenshot showcasing the usage of all the above commands:

    •