Conditions and branching
Branch a workflow with If / Else and Switch, check values with Validate value, wait for a condition, and end a run on purpose.
Workflows decide what to do next with condition nodes. They are containers: each branch is a chain that starts at one of the node's named outputs, and when the branch ends the workflow continues through the container's own next output. You never draw a line back to rejoin.
Writing a condition
A condition is a bare expression — no {{ }} — that is evaluated to true or false:
status == 'paid'
len(found.items) > 0 and not has_error
contains(lower(title), 'invoice')
row.country in ['DE', 'AT', 'CH']
default(row.discount, 0) >= 100,''(empty text),[],{},null,falseand undefined names are false; everything else is true.==between different types is false:'5' == 5is false. Convert withnumber()orstr()first.<,>and friends compare numbers as numbers; if the types do not fit, they compare as text.- See Variables and expressions for every operator and function.
The Problems tab marks an invalid condition as an error before you run.
If / Else
If / Else (if) runs its then output when the condition is true and its else output otherwise. Either output can stay unconnected.
{"id": "check", "type": "if", "params": {"condition": "count == 0"}}with edges such as:
{"id": "e5", "source": "check", "port": "then", "target": "log_empty"},
{"id": "e6", "source": "check", "port": "else", "target": "save_rows"},
{"id": "e7", "source": "check", "port": "next", "target": "close"}Here log_empty or save_rows runs (with whatever follows it in that branch), then the run continues at close. The step log records which branch was taken.
Switch
Switch (switch) compares a value with a list of cases (1–20) and runs the first matching branch; if none match it runs default. A case matches when it is equal to the value or has the same text, so the case "2" matches the number 2. The outputs are labelled with the case values on the canvas.
{"id": "route", "type": "switch",
"params": {"value": "{{ row.type }}", "cases": ["invoice", "credit_note", "receipt"]}}Outputs: case:0, case:1, case:2 and default.
Validate value
Validate value (assert) fails the step with your message when its condition is false. Use it to stop early when a page is not what you expect:
{"type": "assert", "params": {"condition": "found > 0", "message": "{{ must_exist }} is missing"}}Combined with the node's error policy, a failed check can stop the run, be skipped, or follow an error branch.
Wait until condition
Wait until condition (wait_until) re-evaluates its condition every interval_ms (500 ms) until it is true, and fails with timeout after timeout_s (60 s). It reads variables only; to wait for something on the page, use the browser waits — Wait for element, Wait for text, Wait for URL, Wait for page load or Wait for network response.
Conditions on page state
Browser reading nodes produce values a condition can test. Save them with Save to:
| Node | Saved value | Example condition |
|---|---|---|
| Count elements | a number | rows_on_page == 0 |
| Is visible / Is enabled / Is checked | true or false | not next_visible |
| Get text | text | contains(banner, 'Out of stock') |
| Get attribute | text or null | aria == 'true' |
| Get current URL | {url} | contains(here.url, '/login') |
Is visible answers at once; it does not wait. Use Wait for element first when the page is still loading.
Ending a run on purpose
Stop workflow (stop) ends the run immediately with a status — completed or failed — and a message. A failed stop is recorded with the error code stopped and your message, so it is easy to find in History → Failures. End finishes the workflow successfully at that point.
Inside a called workflow, Return ends it and hands a value back to the Call workflow node.
Tips
- Keep conditions short; compute values first with Set variable or Calculate, then branch on a simple name.
- Use Filter list (
list.filter) instead of a loop with an If when you only need the matching items: its condition sees each element asitem, for examplenumber(item.price) < 20. - Branches can contain other containers — loops inside conditions and the other way round — up to 50 levels deep.