Block reference / Control flow
Repeat task
Run a stretch of blocks a set number of times, then carry on.
In both apps
WarpX Browser
WarpX Phone
Use Repeat task when you need the same few steps several times and do not need a list, such as clicking a "Load more" button three times. Its bottom output, Repeat from, leads to the blocks to repeat, and the last of those connects back into the Repeat task. Once the count is reached, the run leaves by the top output.
Settings
- times
Typed straight into the block on the canvas; the block has no settings panel. How many times the blocks after Repeat from run.
{{references}}work here, such as{{variables.pages}}.Example3
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
Bottom output (Repeat from): taken each time until the count is reached. Top output: taken once, after the last repeat. The block passes the count on as its data.
Example: Click Load more three times before reading the list
- Start
- New tab
- Repeat task
- Click element
- Delay
- Get text
- Add a New tab block with the list page's URL.
- Add a Repeat task block and type
3into it. - Connect Repeat from to a Click element block on
button.load-more, then a Delay of1500ms. - Connect the Delay block back into the Repeat task's input.
- Connect the Repeat task's top output to a Get text block on
.item-titlewith Multiple on.
Good to know
- The repeated blocks must lead back into the Repeat task's input. If they do not, they run once and the run ends at the last of them.
0, or text that is not a number, still runs the repeat path once.- If Repeat from is not connected, the block leaves by the top output at once.
- The count starts again after the block finishes, so it works inside an outer loop.
- There is no counter to read inside the repeat. If you need one, use Loop data with Numbers and
{{loopData.<id>}}.
See also
- Loop data — Run the blocks after it once for each row, number, list item or element.
- While loop — Keep running a stretch of blocks while a condition holds.
- Delay — Pauses the run for a set number of milliseconds before the next block.