Get started

Reference Workflows 06 / 06

Assert step

Require the page to be in an expected state, or fail the run. A step a recorded Writ workflow can run, with its fields and an example.

Runs on Writ CloudWrit Desktop

Open in Claude Open in ChatGPT

The assert step checks that an element is on the page and, when you give it an expected value, that the element says what it should. If the check does not hold the run fails with the difference spelled out — so a workflow that quietly stopped working reports itself instead of returning empty results.

In a workflow, this step is a JSON object with "type": "assert". Steps run in order, and each step can read the outputs of the steps before it.

Fields

Set these inside the step’s config object.

selector selector required
The element the assertion inspects.
value string
The expected text or field value. Omit it to assert only that the element exists. Placeholders resolve at run time: {{key}} from the workflow’s declared inputs, {{vault:name}} for secrets.
match string
"contains" (default) or "exact". Both compare with surrounding whitespace collapsed.

Example

One assert step, as it appears in the steps list of a workflow.

Step
{
  "type": "assert",
  "config": { "selector": ".order-status", "value": "Confirmed" }
}

How it behaves

  • The element is awaited for the step timeout before the assertion is judged, so it tolerates content that is still rendering.
  • Text and field value are both checked, so one step covers a <span> and an <input> without you choosing which.
  • An expected value built from a secret is never echoed back in the failure message.

Where it runs

The step runs wherever its workflow runs. On Writ Desktop, runs are free and can reach systems that only your own network can reach.

On Writ Cloud, each call costs credits: 20 when the run needs a browser, 2 when it does not. A call that fails because of the site or Writ costs nothing.

Next