Conditional branching based on extracted data or runtime conditions
Use if_else_node for conditional execution based on runtime conditions—handling different page states, optional elements, or branching logic.To determine condition logic, use extraction actions to capture data from the page and store it as variables. These variables are then referenced in if_else_node conditions to make branching decisions based on the extracted data.
Extraction nodes allow you to capture data from the page and store it as variables. These variables can then be referenced in if_else_node conditions to make branching decisions based on the extracted data.
How It Works
Extract data using an extraction_action and specify output_variable_names to create a variable
Reference the variable in an if_else_node condition using the syntax variable_name[0]
Branch logic executes different paths based on the extracted value
Variable Naming and Syntax
Variables are referenced using array index syntax: variable_name[0]
The [0] accesses the first (or only) element of the extracted value
Multiple extractions create arrays: variable_name[0], variable_name[1], etc.
Condition Syntax
Conditions are Python-like expressions that can reference parameters:
{ "condition": "is_login_screen[0]"}
{ "condition": "has_2fa[0] == 'true'"}
{ "condition": "verification_needed[0] is not None and verification_needed[0] != 'skip'"}
Operators
Operator
Example
Equality
var[0] == 'value'
Inequality
var[0] != 'value'
None check
var[0] is not None
Boolean
var[0] == 'true'
Logical AND
a[0] == 'x' and b[0] == 'y'
Logical OR
a[0] == 'x' or b[0] == 'y'
Examples
Extract and Check Page State
[ { "type": "action_node", "extraction_action": { "llm": { "extraction_format": { "is_login_page": "bool" }, "extraction_instructions": "Check if the current page is a login page asking for username or password. If yes, return 'is_login_page' as true, otherwise return false", "output_variable_names": [ "is_login_page" ], "llm_model_name": "gemini-4-argon" } }, "before_sleep_time": 3, "end_sleep_time": 0 }, { "type": "if_else_node", "condition": "is_login_page[0]", "if_nodes": [ { "type": "action_node", "interaction_action": { "input_text": { "command": "get_by_label(\"Username\")", "input_text": "{username[0]}" } } } ], "else_nodes": [ { "type": "action_node", "interaction_action": { "click_element": { "command": "get_by_role(\"button\", name=\"Next\")" } } } ] }]