Block reference / Browser

Handle dialog

Answers the page's alert, confirm and prompt dialogs for you.

Only inWarpX Browser

Handle dialog decides in advance how the page's JavaScript dialogs are answered: OK or Cancel, and what to type into a prompt. Run it on the page before the click that opens the dialog. Without it, WarpX Browser dismisses every dialog, as if you had pressed Cancel.

The Handle dialog block's settings, filled in as in the example below.

Settings

Accept dialog

On: alerts are closed, confirm dialogs answer OK, and prompts answer with Prompt text (optional). Off: confirm dialogs answer Cancel and prompts return nothing.

ExampleChecked
Prompt text (optional)when Accept dialog is on

The text to answer a prompt dialog with. You can use references such as {{variables.confirmWord}}. Do not use double quotes in it.

Exampleyes
Delay time (ms)

A pause after the block, in milliseconds, such as 1000. Or a range such as 1000,3000 for a random pause each run.

Example0

Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.

What it hands on

Leaves by its only output. It writes nothing.

Example: Delete a saved address that asks you to type yes

  1. Open URL
  2. Handle dialog
  3. Click element
  4. Element exists
Where Handle dialog sits in the example workflow.
  1. Add Open URL with https://shop.example.com/account/addresses.
  2. Add Handle dialog. Tick Accept dialog and type yes in Prompt text (optional).
  3. Add Click element on button.delete-address. The site's prompt asks you to type yes, and the block answers it.
  4. Add Element exists on .address-deleted to check the address is gone.

Good to know

  • The block only affects the page that is open when it runs. After the page navigates, or in another tab, add Handle dialog again before the next dialog.
  • It changes alert, confirm and prompt in the page itself. It does not reach dialogs raised inside an iframe, or pages whose security policy blocks inline scripts. Those dialogs are dismissed as usual.
  • It does not answer the leave-page prompt (onbeforeunload). While WarpX Browser drives the profile's browser, that prompt is accepted automatically.

See also

  • Click element — Click an element on the page, with human-like mouse movement by default.
  • JavaScript code — Run your own JavaScript in the page, and pass data back to the workflow.
  • Element exists — Check whether an element is on the page and continue by one of two outputs.