How to Handle Dialogs and Popups Generated from the Tested Page
Test Studio recording process recognizes the different dialogs generated from the automated page and detects what actions are taken to handle the dialog. These actions are represented as a single step in the test.
In this article you can find out more about dialog handling in Test Studio tests divided in few sections:
- Alert, Confirm, Prompt Dialog Boxes
- Logon Dialog
- Download and Upload File Dialogs
- Record in a Popup Window
- Maintain the Handle Dialog and Connect to Popup Steps
How to Record a Dialog Displayed from the Tested Page
All sample pages used in this article are from the W3School platform.
Dialogs are automatically recorded in Test Studio test taking your actions as baseline. There is a dedicated step for each different dialog with various properties related to the specifics of the dialog - for example, download/upload file path or text, username, etc. When the tested page prompts any dialog, handle it as you would do without Test Studio and Test Studio recorder will add the step for you.
Tip
If you experience any troubles with recording or executing the dialog steps, check if there is an available update in the Latest Browser Support section and apply it before you proceed.
Alert, Confirm, Prompt Dialog Boxes
JavaScript generates three type of popup messages and these are as follows:
- Alert - often used if some information is to be shared to the user. To proceed the user needs to click 'OK'.
- Confirm - often used when the user needs to verify or accept something. The user needs to click either "OK" or "Cancel" to proceed.
- Prompt - often used if the user should submit a value before entering a page. The user needs to click either "OK" or "Cancel" to proceed after entering the input value.
To try out these types of dialogs you can use the 'Try It Yourself' buttons on each example for the W3School JavaScript Popup Boxes page. Here are the steps recorded in a test for each of the dialog boxes.
Handle Alert Dialog |
Handle Confirm Dialog |
Handle Prompt Dialog |
Handle Logon Dialog |
Handle Upload Dialog |
Handle Download Dialog |