Is it possible to use loops
Yes, with loops you can repeat similar actions several times.
There is 2 type of loop in BorwserAutomationStudio: “For” and “While”.
With “For” you can repeat actions integer number of times, for example, parse 10 first pages, try to get email for 5 times, etc…
With “While” action, you can repeat actions until certain condition is met. Condition format is same as in “If” action. Look at this page for explanation.
Here is some examples: Using for action to parse google output and Using while action to detect page changes
How loops works?
- Every action inside loop body will be executed on every loop iteration. To put actions inside loop body, use cursor, like this:
In following example, “Log” action will be executed 10 times:
- Variable [[CYCLE_INDEX]] always contain current iteration number. This variable can be used in several ways. The simplest one, is to output it to log:
You can also check [[CYCLE_INDEX]] variable in “If” action:
- Loops can be nested. On the next screenshot log action will be executed 15 times:
- You can break current loop at any time with “Break” action: