Repeat steps with Loops
Learn how to execute steps repetitively using loops in your test.
Certain testing workflows require repeating a specific set of steps multiple times. For example, uploading a file multiple times or inviting multiple users to a team or navigating to next result until a specific product appears. The Conditional Loop feature makes this easier. It lets you configure loops to repeat steps until the desired result is achieved.
Supported conditional loops
Low Code Automation provides the following conditional loop blocks:
- Counter: Repeats a set of steps a specific number of times. You can create a loop with a fixed or a variable counter. The maximum limit for the counter is 30.
- Until an element is present: Repeats a set of steps until a specified element appears on the webpage. The user can select an element on the webpage and choose whether to add “presence” or “not presence” as a condition. The process repeats until the configured condition is met or the maximum attempts of 30 are reached.
- Until an element text matches: Repeats a set of steps until the text of a specified element matches the expected value. Users can select an element and choose a condition with operators like equals, contains, or starts with for text, and equals, not equals, between, less than, or greater than for numbers. The loop continues until the condition is met or the max attempts of 30 are reached.
Add conditional loops to test steps
- In the Low Code Automation recorder, click the ︙ icon and select Loops.
This will add a new step with a Add condition for loop block. - In the loop block, click Add condition. Select one of the following options from the following:
- Add the necessary condition and record the steps to repeat. Refer to the use cases below for each loop type.
- Click Save and run.
Loop based on fixed or variable counter
It can be configured as either a fixed or variable counter.
Fixed counter loop
A fixed counter loop is used to execute a predetermined number of iterations. This is useful when the number of repetitions needed is known in advance.
Use case 1: For example, you want to add multiple units of a specific product to the cart. To do this, you can add a counter loop and set the counter value to the desired quantity. While recording, you only need to click the Add to cart button once. During replay, the action will be repeated based on the counter value you’ve set.
Use case 2: For example, if you want to test a form submission for multiple users, you can use a loop to run it multiple times. By using the Functions feature, you can assign different names and email addresses for each iteration. The form will be submitted the specified number of times, each with unique data.
Variable counter loop
A variable counter loop allows the number of iterations to be determined dynamically at runtime. This is ideal when the loop count depends on user input or a changing condition.
Click the curly braces icon to import a variable counter. Local, global, and shared variable types are supported.
Loop until element present/not-present
You can continue looping a particular action until the desired element appears or disappears. In the below example, Low Code Automation will click Next until the correct product image is found.
Loop until element text condition matches
You can continue looping a particular action until the desired text appears. In the below example, Low Code Automation will click Next until the correct product name is found.
Modify the loop condition
You can switch between different loop conditions at any time.
- Click the Change loop condition link next to the loop step.
- Select the loop condition you desire to add.
Delete conditional loops
You can select the loop steps and click the Delete icon at the top. A confirmation dialog appears, click Delete. You can delete one or more steps within the loop or delete the entire loop.
Points to remember
- A loop cannot contain another loop inside it.
- A loop cannot contain a module or if-else steps if the corresponding module or if-else steps also has another loop inside it.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!