assert_locator_node to check whether a specific element is present on the page and store the result. It evaluates a Playwright locator within a timeout and writes a boolean into output_variable_name (true if the assertion passes, false if it does not). You then branch on that variable with an if_else_node.
This is the lowest-overhead way to capture element presence—no LLM call, no extraction step, just a direct visibility check that becomes a reusable variable.
Structure
error_visible = [true] or error_visible = [false]. Reference it later as {error_visible[0]}.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
type | "assert_locator_node" | Required | Node discriminator |
locator | str | Required | Playwright locator command (page.<locator> style) |
assertion | "to_be_visible" | "to_be_hidden" | Required | Condition to test |
output_variable_name | str | Required | Variable to store the boolean result, as a single-element list (e.g. [true]) |
timeout | float | 5.0 | Seconds to wait for the assertion before treating it as failed |
[0] (e.g. {error_visible[0]}).
Assertions
| Assertion | Result is true when |
|---|---|
to_be_visible | The element exists in the DOM and is visible within timeout seconds |
to_be_hidden | The element is absent or hidden within timeout seconds |
timeout, the variable is set to false (no error is raised). If the locator does not resolve at all, the result is also false.
Examples
Dismiss an element only when it appears
Check whether an error alert is visible, then dismiss it with a followingif_else_node:
Wait for a spinner to disappear, then branch
Wait up to 10 seconds for a loading spinner to be hidden, then submit or fail:Variable substitution in the locator
locator supports {variable[index]} substitution, so you can target elements dynamically:
assert_locator_node vs if_else_node
assert_locator_node | if_else_node | |
|---|---|---|
| Role | Captures element visibility as a boolean variable | Branches on a Python expression over a variable |
| Condition | Playwright locator visibility | Python expression on a variable |
| Requires extraction? | No | Yes — needs a variable to branch on (e.g. from assert_locator_node or an extraction_action) |
| Cost | Zero (no LLM) | Zero (expression eval) |
| Best for | Element present/absent checks | Acting on a captured boolean or comparing extracted values |
assert_locator_node produces the boolean; if_else_node consumes it. Pair them to run steps conditionally on element presence, or use the variable in any later condition.
Locator Syntax
Thelocator field uses the same Playwright command syntax as interaction actions—omit the leading page.: