Dialogs & windows
Task-first recipes for dialogs & windows.
Handle a popup window
Wait for a popup around the click that opens it, then act on the new page.
Handle a JavaScript dialog
Register a dialog handler before the action, then accept, dismiss, or answer alert, confirm, and prompt.
Handle a beforeunload dialog
Register a dialog handler for the leave-page prompt, and know what the PHP API can trigger today.