Use for_loop_node to repeat actions for each value in a list—processing search results, downloading multiple files, or clicking through items.
Structure
Properties
| Property | Type | Description |
|---|
variable_name | str | Parameter to iterate over |
nodes | list[action_node | if_else_node] | Actions for each iteration |
reset_nodes | list[action_node | if_else_node] | Actions to run after each iteration |
on_error_in_loop | "continue" | "break" | "raise" | Error handling behavior |
The index Variable
Inside a loop, {variable[index]} references the current iteration’s value:
Using Multiple Variables in a Loop
You can iterate over multiple parameters in parallel by passing a comma-separated list to variable_name.
Important: The first in variable_name is the main loop variable that controls:
- How many iterations run (loop length)
- Which index is used for each step
All additional names in the list are synced to the same index. In other words:
variable_name: "primary_var,secondary_var" → loop length comes from primary_var
{primary_var[index]} and {secondary_var[index]} both use the same index on each iteration
For each iteration, {variable[index]} is expanded for every name in the list:
If your parameters are:
primary_var = ["Value A1", "Value A2"]
secondary_var = ["Value B1", "Value B2"]
Then:
- Iteration 1 uses
{primary_var[index]} → "Value A1" and {secondary_var[index]} → "Value B1"
- Iteration 2 uses
{primary_var[index]} → "Value A2" and {secondary_var[index]} → "Value B2"
Data Sources
Loop variables can come from:
| Source | When to Use |
|---|
input_parameters | Known values before execution |
generated_parameters | Values extracted during automation |
secure_parameters | Sensitive values from secure storage |
For dynamic iteration, extract values first:
Reset Nodes
Actions that run after each iteration to return the browser to a known state. Essential for loops that navigate away from the starting page.
Reset Strategy Recommendations
| Action | Reliability | Use When |
|---|
close_tabs_until | High | Actions open new tabs |
go_to_url | High | Navigate to known URL |
click_element (navbar) | Medium | Persistent navigation exists |
go_back | Low | Avoid—fails on errors |
Avoid go_back for reset nodes. If an error occurs mid-loop, the browser may be on an unexpected page.
Error Handling
| Behavior | Description |
|---|
"raise" | Stop automation on error (default) |
"continue" | Skip failed iteration, continue to next |
"break" | Stop loop, continue with next node outside loop |
Use "continue" when some items may fail but you want to process as many as possible (e.g., downloading files where some may be missing).
Common Patterns
Download Multiple Files
Process Items and Return
Limitations
- Nested loops are not supported
- Variable must be populated before loop execution
- Only
action_node and if_else_node allowed inside loops