Skip to content

Loop Recording

Loop Recording lets you record a sequence of actions once, then tell RTILA X to repeat those actions multiple times or under specific conditions. Instead of recording the same steps over and over, you record them once and define how they should repeat.

This is perfect for tasks like scraping multiple pages of search results, filling out the same form with different data, or processing a list of items one by one.

Recording indicator showing “Start Loop” and “Stop Loop” buttons alongside the main recording controls


Loop recording is ideal for any task that involves repetition:

Use Case Example
Scraping multiple pages Scrape page 1, click “Next”, scrape page 2, repeat for 10 pages.
Filling forms repeatedly Fill a form with data from a list, submit, repeat for each entry.
Processing search results Click each search result, extract data, go back, repeat.
Batch operations Perform the same action on multiple items in a list.
Pagination scraping Navigate through paginated content, extracting data from each page.
Multi-step workflows Record a multi-step workflow once and repeat it for each item in a dataset.

  • Recording must already be active (the red recording indicator must be visible).
  • You must be on the page where you want to begin the loop actions.
  1. Start a recording (see Auto-Recording if you haven’t already).
  2. Navigate to the page where your loop actions should begin.
  3. On the recording indicator bar, click the “Start Loop” button.
  4. The indicator text changes to “Recording Loop Actions… 🔁” and the loop button changes to “Stop Loop” (orange).
  5. Perform the actions you want to repeat. These are the actions that will loop.
  6. When you’ve finished the actions for one iteration, click “Stop Loop”.

Important: Only the actions performed between clicking “Start Loop” and “Stop Loop” are captured as loop content. Actions before “Start Loop” are recorded as regular (non-looping) commands.


After clicking “Stop Loop”, a Loop Configuration modal appears. This is where you define how the recorded actions should repeat.

Loop Configuration modal showing loop type dropdown and configuration options

The modal presents three loop types. Choose the one that matches your use case:

This is the simplest loop type. The recorded actions repeat a specific number of times.

Setting Description Example
Number of Iterations How many times to repeat the loop actions. 5 = repeat 5 times

Use when: You know exactly how many times the actions need to repeat. For example, “scrape the next 10 pages” or “fill this form 5 times.”

Example:

  • You record: Click “Next Page” → Extract data → Wait for load.
  • Set iterations to 10.
  • Result: RTILA repeats those 3 actions 10 times, scraping 10 pages total.

This loop type repeats the actions as long as a specific element is visible on the page. When the element disappears or becomes hidden, the loop stops.

Setting Description Example
Element Selector The CSS selector of the element to check. The loop continues while this element is visible. css=.next-page-button

Use when: You don’t know how many iterations are needed, but you know when to stop. For example, “keep clicking ‘Next’ while the Next button is visible.”

Example:

  • You record: Click “Next Page” → Extract data → Wait for load.
  • Set condition selector to css=.next-page-button.
  • Result: RTILA repeats the actions as long as the “Next Page” button is visible. When there are no more pages, the button disappears and the loop stops automatically.

Tip: Use a selector that reliably indicates whether more iterations are needed. A “Next” button that disappears on the last page is a perfect condition element.

This is the most powerful loop type. It iterates over a list of items, performing the recorded actions once for each item.

Setting Description Example
Source Type Where the items come from: a List Variable or an Extracted Dataset. List Variable
Variable Name (For List Variable) The name of the variable containing the items. keywords
Dataset Name (For Extracted Dataset) The name of a previously extracted dataset. primary
Assign to loop variable (as) The variable name that holds the current item during each iteration. item

Use when: You need to perform the same actions for each item in a list. For example, “for each product in my dataset, visit its page and extract details.”

Example:

  • You have a dataset called products containing product URLs.
  • You record: Go to product URL → Extract details → Go back.
  • Set source to “Extracted Dataset”, dataset name to products, iterator name to product.
  • Result: RTILA iterates through each product in the dataset, visiting each product page and extracting details.

After configuring and saving a loop, it appears as a single loop command in the Web Automation tab, containing all the recorded actions as nested commands.

The loop appears as a repeat command:

repeat (5 times)
├── click (css=.next-button)
├── wait_for_load_state
└── extract_data (products)

The loop appears as a while command:

while (css=.next-page-button is visible)
├── click (css=.next-button)
├── wait_for_load_state
└── extract_data (products)

The loop appears as a for_each command:

for_each (dataset: products, as: product)
├── goto (${product.url})
├── extract_data (product_details)
└── go_back

Command list showing a repeat command with nested commands indented underneath


Loops can be edited just like any other command:

  1. Open the project in the Visual Builder.
  2. Switch to the Web Automation tab.
  3. Click on the loop command to expand it.
  4. Edit the loop parameters:
    • For repeat: Change the number of iterations.
    • For while: Change the condition selector.
    • For for_each: Change the source type, variable/dataset name, or iterator name.
  1. Click the loop command to expand it.
  2. Click the toggle visibility button (eye icon) to show nested commands.
  3. Click any nested command to edit its parameters.
  4. You can also add new commands inside the loop or delete existing ones.

You cannot directly change a loop’s type (e.g., from repeat to while). To change the loop type:

  1. Delete the existing loop command.
  2. Re-record the loop actions with the new loop type.

When using the “For Each Item in List/Dataset” loop type, the current item is available as a variable inside the loop. By default, this variable is called item, but you can rename it using the “Assign to loop variable (as)” field.

Use the ${variable_name} syntax to reference the current item:

${item}

If you have a dataset called products with properties name, url, and price:

for_each (dataset: products, as: product)
├── goto (${product.url}) ← Navigate to each product's URL
├── extract_data (product_details) ← Extract details from the product page
├── set_variable (current_name, ${product.name}) ← Save the product name
└── go_back ← Go back to the listing page

If you have a list variable called keywords with values:

web scraping
data extraction
browser automation

And a for_each loop with as: keyword:

for_each (variable: keywords, as: keyword)
├── goto (https://example.com/search?q=${keyword})
├── extract_data (search_results)
└── wait (2000)

RTILA will iterate through each keyword, searching for each one and extracting results.

If your list variable contains semicolon-separated values (CSV format):

john;admin;user1
jane;editor;user2
bob;viewer;user3

You can access individual columns using JavaScript:

${item.split(';')[0].trim()} → "john"
${item.split(';')[1].trim()} → "admin"
${item.split(';')[2].trim()} → "user1"

Tip: The right-click context menu in the Visual Builder automatically detects CSV columns and offers them as insertion options. Right-click on any input field and choose Insert Variable to see available columns.


Warning: Stopping Recording During an Active Loop

Section titled “Warning: Stopping Recording During an Active Loop”

If you try to stop the main recording while a loop recording is still active, RTILA X shows a warning:

“Loop Recording Active” You are currently inside an active Loop Recording session. Please click the Stop Loop button on the recording indicator first before you stop the main recording.

This prevents incomplete loop recordings. You must:

  1. Click “Stop Loop” on the recording indicator.
  2. Configure the loop in the modal that appears.
  3. Then you can stop the main recording.

Here’s a complete example of using loop recording to scrape multiple pages of search results:

You want to scrape product listings from an e-commerce site with pagination (10 pages of results).

  1. Start recording — Click Record in the ribbon.
  2. Navigate to the search page — Type the search URL in the address bar.
  3. Click “Start Loop” — The indicator changes to “Recording Loop Actions… 🔁”.
  4. Perform the loop actions:
    • Extract product data from the current page.
    • Click the “Next Page” button.
    • Wait for the page to load.
  5. Click “Stop Loop” — The loop configuration modal appears.
  6. Configure the loop:
    • Choose “While Element Is Visible”.
    • Set the selector to css=.next-page-button.
  7. Click “Save Loop” — The loop is saved as a while command.
  8. Stop the main recording — Press Alt+Shift+X.
  9. Review and save — Open the side panel, verify the commands, and save.

Your project now contains:

goto (https://example.com/search?q=products)
while (css=.next-page-button is visible)
├── extract_data (products)
├── click (css=.next-page-button)
└── wait_for_load_state

When you run this project, RTILA will:

  1. Navigate to the search page.
  2. Extract product data.
  3. Click “Next Page”.
  4. Repeat steps 2–3 as long as the “Next Page” button is visible.
  5. Stop when there are no more pages.

Tip Why It Matters
Keep loop actions minimal Record only the actions needed for one iteration. Extra actions slow down the loop.
Use reliable condition selectors For while loops, choose a selector that reliably indicates when to stop.
Add waits inside loops Add wait commands between actions to give pages time to load between iterations.
Test with a small iteration count When using repeat, test with 2–3 iterations first before increasing the count.
Use datasets for complex loops For for_each loops, extract a dataset first, then loop through it.
Add error handling Wrap risky loop actions in try_catch blocks to handle errors gracefully.
Monitor loop progress Watch the execution logs to verify the loop is progressing correctly.

Problem Solution
“Start Loop” button doesn’t appear Make sure recording is active. The button only appears while recording.
Loop captures too many actions Click “Stop Loop” sooner. Only actions between “Start Loop” and “Stop Loop” are captured.
Loop condition never triggers Check the selector. Make sure the element is visible when the loop should continue.
Loop runs forever Add a max_scrolls limit or use a repeat loop with a fixed count instead.
Loop variable is empty Check the source variable/dataset name. Make sure it exists and contains data.
Loop doesn’t iterate through all items Check the dataset or variable contains all expected items. Verify the iterator name matches.