Dialog & Download Actions

Actions for handling browser dialogs (alert, confirm, prompt), waiting for downloads and network activity, and clicking on canvas elements.

init_dialog

type: init_dialog
type: initdialog

Register a default dialog handler before the action that triggers it. Browser dialogs (alert, confirm, prompt) block the page — if you don't have a listener ready, the script hangs. This sets up an auto-accept handler for the next dialog.

ParamTypeDescription
No parameters — registers a default accept handler.
JSON
// Set up handler BEFORE the click that triggers the dialog
[
  { "type": "init_dialog" },
  { "type": "click", "selector": "#delete-btn" }
]

handle_dialog

type: handle_dialog
type: handledialog

Configure how browser dialogs are handled. Sets the action (accept or dismiss), optional prompt text, and whether the handler persists for all future dialogs.

ParamTypeDescription
actionoptionalstring"accept" (default) or "dismiss". Alias: dialogAction.
textoptionalstringText to enter in prompt() dialogs before accepting. Alias: promptText.
persistentoptionalbooleanIf true, handle ALL future dialogs this way (not just the next one). Default: false.
JSON
// Dismiss a dialog
{ "type": "handle_dialog", "action": "dismiss" }

70
{ "type": "handle_dialog", "action": "accept", "text": "CONFIRM" }

165
{ "type": "handle_dialog", "action": "accept", "persistent": true }

init_dialog vs handle_dialog

ScenarioUse
You know which click opens the dialoginit_dialog → click
Dialog appears on page loadhandle_dialog (reactive)
Need to dismiss instead of accepthandle_dialog with action: "dismiss"
All dialogs on this page should be acceptedhandle_dialog with persistent: true

wait_for_download

type: wait_for_download
type: waitfordownload

Wait for a file download to complete. Optionally clicks a trigger element first. Resolves when the file has been fully saved. Reports the filename when done.

ParamTypeDescription
selectoroptionalstringClick this element to trigger the download. Alias: triggerSelector.
timeoutoptionalnumberMax wait time in ms. Default: 30000.
JSON
// Click the download button and wait for the file
{ "type": "wait_for_download", "selector": "#download-report", "timeout": 60000 }

134
{ "type": "wait_for_download" }

wait_for_network_idle

type: wait_for_network_idle
type: network_idle

Waits for all network requests to settle. Useful after navigation or AJAX-heavy operations to ensure the page has finished loading data.

ParamTypeDescription
timeoutoptionalnumberMax time to wait in ms. Default: 10000.
idleTimeoptionalnumberHow long the network must be quiet to be considered idle, in ms. Default: 500. Alias: idle_time.
JSON
{ "type": "wait_for_network_idle" }

{ "type": "wait_for_network_idle", "timeout": 15000, "idleTime": 1000 }

110
{ "type": "network_idle", "timeout": 5000 }

click_canvas

type: click_canvas
type: clickcanvas

Click at specific pixel coordinates within a canvas element. Used for map interactions, drawing tools, or any canvas-based UI.

ParamTypeDescription
selectorrequiredstring | arrayCSS selector for the canvas element.
xrequirednumberX coordinate within the canvas (pixels from left edge). Default: 0.
yrequirednumberY coordinate within the canvas (pixels from top edge). Default: 0.
indexoptionalnumberWhich visible canvas to click (0 = first). Default: 0.
JSON
{ "type": "click_canvas", "selector": "canvas#map", "x": 150, "y": 200 }

{ "type": "click_canvas", "selector": ".drawing-canvas", "x": 50, "y": 50 }