UseDocumentation Index
Fetch the complete documentation index at: https://docs.optexity.com/llms.txt
Use this file to discover all available pages before exploring further.
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.
Structure
has_captcha are extracted from the page using an extraction action (see Using Extraction Nodes to Set Conditions below).
Properties
| Property | Type | Description |
|---|---|---|
condition | str | Python-like expression to evaluate |
if_nodes | list[action_node | if_else_node | for_loop_node] | Actions when condition is true |
else_nodes | list[...] | Actions when condition is false (optional) |
Using Extraction Nodes to Set Conditions
Extraction nodes allow you to capture data from the page and store it as variables. These variables can then be referenced inif_else_node conditions to make branching decisions based on the extracted data.
How It Works
- Extract data using an
extraction_actionand specifyoutput_variable_namesto create a variable - Reference the variable in an
if_else_nodecondition using the syntaxvariable_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: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
Handle Optional 2FA
Branch Based on Extracted Value
Nested Conditions
else_nodes is optional. If omitted or empty, nothing happens when condition is false.