Skip to main content

Conditions

A condition is a boolean predicate the engine polls every 100ms until it passes or the step's timeout expires. The same condition types appear as expect, precondition, recovery trigger, and flow-control predicates.

Element Conditions

These conditions locate an element within an anchor's subtree using a selector.

TypeTrue when
ElementFoundThe selector matches at least one element
ElementEnabledThe matched element is enabled (not greyed out)
ElementVisibleThe matched element is visible on screen
ElementHasTextThe matched element's text satisfies a pattern
ElementHasChildrenThe matched element has at least one child

All five require scope (anchor name) and selector.

expect:
type: ElementFound
scope: editor
selector: ">> [role=button][name=Save]"

ElementHasText and TextMatch

ElementHasText requires a pattern block. Exactly one field should be set:

expect:
type: ElementHasText
scope: results_panel
selector: ">> [role=text][name=Status]"
pattern:
contains: "Complete"
Pattern fieldBehaviour
exactExact string match
containsSubstring match
starts_withPrefix match
regexfancy-regex pattern (supports backreferences, lookahead)
non_empty: trueTrue when the text is not empty

{output.*} substitution is applied to exact, contains, and starts_with values at evaluation time.

Use regex when the other match modes cannot express the condition. The main reason to reach for it over a plain pattern is backreferences: matching the same value in two positions. A common case is detecting when a progress counter reaches completion:

- intent: wait for processing to finish
action:
type: NoOp
expect:
type: ElementHasText
scope: status_bar
selector: ">> [role=edit][name=Progress]"
pattern:
regex: "^(\\d+) of \\1$"
timeout: 120s

(\d+) of \1 matches text like "123 of 123" (where the total equals the current count) using a backreference to the first capture group. exact cannot be used because the numbers are not known in advance. Only the backreference can express "these two numbers must be the same."

Browser Conditions

TypeFieldsTrue when
TabWithAttributescope (Tab anchor), titleThe browser tab matches the given title
TabWithStatescope (Tab anchor), exprThe JS expression evaluates to a truthy value in the tab

TabWithAttribute requires a Tab anchor as scope. Use it after BrowserNavigate to confirm that the page has loaded:

expect:
type: TabWithAttribute
scope: git_tab
title:
contains: "Git for Windows"

title uses the same TitleMatch patterns as WindowWithAttribute: exact, contains, starts_with.

TabWithState evaluates an arbitrary JavaScript expression in the tab and passes when the result is truthy. Use it to wait for dynamic page conditions that are not reflected in the tab title:

expect:
type: TabWithState
scope: git_tab
expr: "document.readyState === 'complete'"

Window Conditions

TypeFieldsTrue when
WindowWithAttributetitle, automation_id, pid, processAny application window matches the given attributes
ProcessRunningprocessAny window belongs to the named process
WindowClosedanchorThe anchored window is no longer open
WindowWithStateanchor, stateThe anchor's window is in the given state
DialogPresentscopeThe scope anchor's window has a dialog child
DialogAbsentscopeThe scope anchor's window has no dialog child
ForegroundIsDialogscope, title (optional)The OS foreground window is a dialog, optionally matching a title

WindowWithAttribute requires at least one of title, automation_id, or pid. process is an optional filter.

expect:
type: WindowWithAttribute
title:
contains: "Save As"
process: notepad

WindowWithState accepts state: active (foreground window) or state: visible (not minimized or hidden).

expect:
type: WindowWithState
anchor: main_window
state: active

System Conditions

TypeFieldsTrue when
FileExistspathThe file exists on disk
ExecSucceededThe most recent Exec action exited with code 0
EvalConditionexprThe expression evaluates to true
AlwaysAlways true immediately

FileExists.path supports {output.*} substitution.

EvalCondition evaluates a boolean expression against the current output, locals, and params. Operators: ==, !=, <, >, <=, >=, &&, ||.

expect:
type: EvalCondition
expr: "output.count > 0"

Always is used as expect on steps where the action itself guarantees success (e.g. NoOp, Capture, Eval).

Logic Combinators

Compose conditions with AllOf, AnyOf, and Not.

expect:
type: AllOf
conditions:
- type: ElementFound
scope: panel
selector: ">> [name=Done]"
- type: DialogAbsent
scope: main_window
precondition:
type: Not
condition:
type: FileExists
path: "{output.output_path}"

AllOf short-circuits on the first false; AnyOf short-circuits on the first true.

TitleMatch

WindowWithAttribute.title and ForegroundIsDialog.title use TitleMatch:

FieldBehaviour
exactExact window title
containsTitle contains substring
starts_withTitle begins with prefix