dialog_auto_handle
Auto-handle native browser dialogs (alerts, confirms, prompts, beforeunload) with persistent accept/dismiss settings. Update action, types, or disable without re-arming.
Instructions
⭐ Install a PERSISTENT auto-handler for native browser dialogs. Unlike dialog_handle (one-shot, action baked in at arm time), this one stays armed across many dialogs and reads its config at fire time — call again with new action/types to update without re-arming.
Args:
action: "accept" (Leave / OK) or "dismiss" (Cancel / Stay)
enabled: True to arm, False to disable (config preserved)
types: optional list to scope handling — any of:
["alert", "confirm", "prompt", "beforeunload"]
None (default) = handle all types.
text: prompt response when action="accept" on prompt() dialogs;
also basic-auth "user:pass" for HTTP 401.
Common patterns:
# Form pages with "unsaved changes" guard — auto-leave forever
dialog_auto_handle(action="accept", types=["beforeunload"])
# Pages that spam alert() — auto-OK
dialog_auto_handle(action="accept", types=["alert"])
# Disable when done
dialog_auto_handle(enabled=False)
Native dialogs only (Chrome's own card UI). HTML/CSS modal overlays
are regular DOM — use click_text("Cancel") / click_role for those.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | accept | |
| enabled | No | ||
| types | No | ||
| text | No |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |