ZeroWork
  • 👋Home and Welcome
  • 🚀Getting Started
  • ⬇️Install the Agent
  • 🧑‍💻Crash Course
  • Using ZeroWork
    • 🖥️General: Run, Schedule, Share, Webhooks
      • Run
      • Stop
      • Log in to the Agent
      • Run Modes
        • Run Incognito
        • Run Non-Incognito
        • Run in My Regular Browser
      • Run Settings
        • Run in Background
        • Stay on Page after Run
        • Bring Pages to Front
      • TaskBot Sharing Options
      • Cookies
      • Scheduler
      • Trigger Run via Webhook
      • Proxies
      • Remote (Cloud) Execution
      • How to Check and Update Your Agent
      • Install ZeroWork Agent on VPS
    • 📔Using Selectors
      • What Are Selectors
      • Use Element's Text
      • Copy Selectors
      • How to Build Custom Selectors
        • Basic Concepts of Selectors
        • One Element Can Have Many Selector Expressions
        • Check if Selector Is Correct and Unique
        • Exact or Loose Match
        • Hierarchy
        • Combine Filters with Standard CSS Logic
        • Lists: Incremental CSS Selectors
        • Addressing Siblings
      • How to Use XPath in ZeroWork (advanced)
    • 🏗️Using Building Blocks
      • Open Link
      • Save Page Url
      • Switch or Close Tab
      • Go Back or Forward
      • Switch Frame
      • Browser Alert
      • Click Web Element
      • Check Web Element
      • Save Web Element
        • Save Lists
        • Enrich Existing Data
        • Stop Run If Selector Is Not Found Option
      • Insert Text or Data
      • Hover Web Element
      • Select Web Dropdown
      • Keyboard Action
      • Start Condition and Set Condition
        • Actions = & ≠
        • Actions <, ≤, >, ≥
        • Data Found & Data not Found
        • Contains & Does Not Contain
        • Before (Date) & After (Date)
      • Start Repeat
        • Standard Loop
        • Dynamic Loop
        • Continue until No Element Is Found
        • Auto-Scroll
        • Auto-Continue from Last Row or Element
        • Nested Loops - Handle Pagination
      • After Repeat
      • Break Repeat
      • Try-Catch
      • Raise Error
      • Abort Run
      • Update Data
      • Number Operations
        • Example: Standardize different formats
      • Format Data
        • Remove Words
        • Shorten Content Length
      • Split Data
      • Apply Regex
      • Remove Duplicates
      • Delete Data
      • Ask ChatGPT
      • Send Notification
      • APIs: Send HTTP Request
      • Write JavaScript
      • Save File
      • Upload File
      • Delay
      • Record Date
      • Take Screenshot
      • Save from Clipboard
      • Log
      • Building Block Options
        • Delay Times between the Building Blocks
        • Randomize Delay Time
        • Deactivate Building Blocks
        • Shortcuts
        • Spintax
        • Auto-Align
        • Sticky Notes
    • 🔀Using Variables
    • 💿Using Tables
      • How to Add Tables
      • Native Tables
      • Google Sheets
      • Import Data from CSV
      • Using Google Sheet vs. Native Tables
      • Create Columns
      • Export Data as CSV
      • Convert Native Table to a Google Sheet
    • 📄Using Run Reports
    • 😑Common Problems
      • My TaskBot Does Not Start Run
      • When I Use Data from Table, No Data is Being Pulled
      • Website is Glitching and Flashing
      • No Selector is Found
      • My TaskBot Saves Some Data but Not All
      • Data Is Saved in Wrong Format
      • Website Requires SMS or Email Verification
      • Keyboard Action Is Not Working As Expected
      • Check Web Element Identifies Selector as Found but Next Action Does Not
      • When Using Insert Data Block, First Letters Are Cut Off
      • Workflow Has More than One Starting Building Block
      • TaskBot Does Not Automatically Scroll
  • Support
    • 🆘Getting Support
  • 🆕Release Notes
    • Version 1.1.61
    • Version 1.1.62
    • Version 1.1.63
    • Version 1.1.64
    • Version 1.1.65
    • Version 1.1.66
    • Version 1.1.67
    • Version 1.1.68
Powered by GitBook
On this page

Was this helpful?

  1. Using ZeroWork
  2. Using Building Blocks
  3. Start Repeat

Standard Loop

Standard loop is used to append new rows to your table.

Suitable for

  • Saving new data - example: scraping a list of profiles from a public website.

  • Performing static actions - example: repeatedly pressing keyboard tab key.

Key characteristics

  • Creates new rows in your table. Creates means appends.

  • Can manipulate the data in the rows that are appended during the loop. For example, you can add building blocks like Format Data to transform the format of the data that you are saving. Whatever actions your TaskBot takes during a loop iteration, they will all be applied to the same to-be-appended row.

  • Ignores any existing data in your tables. If you need to refer to the existing data, use variables, which are loop-independent (or, if applicable, select dynamic loop type, see Dynamic Loop).

  • Automatically scrolls if the data is displayed in an endless scroll (unless you select auto-detect option, see here: Continue until No Element Is Found!).

Example set-up

See Save Lists (link includes video tutorial).

How to Use Loop Index Syntax to Save Lists of Public Data

Once you review the example above (here is the same link again: Save Lists), you will see that the list selector contains {loop_index}, so that TaskBot can iterate over items in the list.

Selectors of items in a list contain a number by which they increment, as described here: Lists: Incremental CSS Selectors. In place of that number, you need to insert {loop_index}. Same principle applies both to CSS and XPath selectors.

Here is how to do that.

Step 1: Simply copy two to three selectors from the list you want to save. As an example, consider these are the first three selectors from the list that you copied.

Original:

  • 1st result in the list: main#main li:nth-child(1) > div.abi-saved-contacts-row__details > button[type='button'] > div > div > span

  • 2nd result in the list: main#main li:nth-child(2) > div.abi-saved-contacts-row__details > button[type='button'] > div > div > span

  • 3rd result in the list: main#main li:nth-child(3) > div.abi-saved-contacts-row__details > button[type='button'] > div > div > span

Notice how all the selectors in the list will display an incremental number (highlighted in red above).

Step 2: Substitute the incremental number by loop index.

main#main li:nth-child({loop_index}) > div.abi-saved-contacts-row__details > button[type='button'] > div > div > span

Alternative way if you don't know where exactly the increment takes place:

main#main li:nth-child(1) > div.abi-saved-contacts-row__details > button[type='button'] > div > div > span >> nth={loop_index}

In this case, we are using a filter (>>), as described here: Combine Filters with Standard CSS Logic.

Starting point

Optionally, you can specify your starting point like this: {loop_index,2} where 2 means that the count should start from the 2nd element.

Note that the :nth-child() method starts count from 1, whereas the >> nth= method starts count from 0 (0 corresponds to the 1st element in the list, 1 to the 2nd, etc.).

Special case: Skip items

In rare cases, a list might skip some numbers. For example, consider this list:

  • 1st result in the list: main#main li:nth-child(1) > div.abi-saved-contacts-row__details > button[type=“button“] > div > div > span

  • 2nd result in the list: main#main li:nth-child(3) > div.abi-saved-contacts-row__details > button[type=“button“] > div > div > span

  • 3rd result in the list: main#main li:nth-child(5) > div.abi-saved-contacts-row__details > button[type=“button“] > div > div > span

In this case, you can use this syntax: {loop_index,1,2}, where the additional number (in this case it's 2) means that two elements should be always skipped when incrementing the loop index.

Advanced use: Referencing the loop index of a parent loop

You can add a loop ID like this: {loop_index_123}, where 123 corresponds to the ID of the Start Repeat building block.

This is useful when you need to reference the loop index of a parent loop. A common use case is when looping through web tables: the parent loop iterates over rows, and the child loop iterates over columns — allowing selectors to access both the parent and child loop indices.

PreviousStart RepeatNextDynamic Loop

Last updated 17 days ago

Was this helpful?

🏗️