Handle Sequential Dialogs
Use page.once('dialog', ...) to handle a single dialog, or keep a counter in your page.on('dialog') handler for different responses.
Task:
- Navigate to
https://testkru.com/Interactions/Alerts - Set up a dialog handler that accepts the first dialog and prints its message
- Trigger the "Show Alert" button
- Wait briefly, then set up a new handler for the confirm dialog that dismisses it
- Trigger the "Show Confirm" button
- Print the confirm result
Expected output:
Alert: This is a simple alert! Confirm result: You clicked: Cancel
TestKru