Handle JavaScript dialog
handle_dialogResolve JavaScript alert, confirm, or prompt dialogs that block page operations. Accept or dismiss the dialog, with optional text for prompt() dialogs, to unblock automation.
Instructions
Answer an open JavaScript dialog — alert, confirm or prompt.
A dialog blocks the page and every subsequent tool call until it is handled, so call this as soon as one appears. Returns an error if no dialog is open.
beforeunload dialogs triggered by navigating away are handled automatically
via navigate_page's handle_before_unload parameter; this tool is for
dialogs the page opens by itself.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Accept (OK) or dismiss (Cancel) the dialog. Either closes an alert(); for confirm() the choice is what the page's JavaScript receives. | accept |
| prompt_text | No | Text to enter into a prompt() dialog before accepting it. Ignored for alert() and confirm() dialogs. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |