Iterations Tutorial
“Control the flow of a task using iterations”
This Tutorial
This tutorial assumes you already have the skills taught in the previous tutorial.
To keep all the concepts simple, we will make a simple list of URLS and have ORQA open a new browser for each of the URL’s we have in a list.
What is the Iteration operation?
To iterate means to loop through a set of data. Therefore, the iteration operation executes series of sub-operations encircle in a loop that can include the usage of a new set of parameters each time.
This is useful in a wide range of tasks, such as when getting a lot of information from the Internet in a very short time. In this tutorial we will iterate over a list of stock names and get the price of each one.
Creating Your First Iteration Task
1. Create Your Iteration Task
Right-click again on the folder you just created and select New > Task. A popup window will appear and you can enter a task name (e.g. myURLTask) and click Finish.
2.Create a list of 10 URLS you want to load
Create an Excel of CSV file of around 10 URLS. The URLs you choose don’t matter so you can pick anything. i.e. www.google.com and www.testing.com
You can download the Excel file here or create your own file.
3. Load the file in ORQA
In the “Toolbox” window select the “Data Input/Output” category from the operation categories that are available. Double-click on the “Read from Excel” operation in order to add it to your task (you can also drag-and-drop it).Select as the input parameter the Excel file with the url Data.
4. Assigning Names To Your Data
Name the output of the “Read from Excel File” operation to be able to use it in following operations.
In the task editor Panel, select the “Read from Excel File” operation and write an output name. E.g. “url”
5. Add a “Loop Through Set” operation
In the “Toolbox” window select the “Control Flow” folder, then add the “Loop Through Set” operation to your task.
Configure the operations parameters with:
Parameter | Description |
---|---|
Set | =url (or the name you assigned to your data) |
Current Item Name | row (the name of the value to use in the loop) |
Loop Number | 10 (because the data contains 10 rows) |
6. Add a “Open Web Browser” operation
In the “Toolbox” window select the “Web Automation” category from the operation categories that are available. Double-click on the “Open Browser” operation in order to add it to your task (you can also drag-and-drop it).
Configure the operations parameters with:
Parameter | Description |
---|---|
Browser | Firefox |
Assign I.D. | urlLoop |
7. Select The URL
In the “Toolbox” window select “Go to URL in Browser” and add it to your task. This is the operation that will be in charge to open the URL from our list.
Parameter | Description: |
---|---|
URL | =row.get(“url”) |
the parameter used {=row.get(“url”)} means that it would return the url of the current row
8. Add the Web Operations under the Loop
To be able to loop through the web operations you will need to locate the operations under the loop. Simply select the “Open web Browser” and “Select the URL” operations and move them to the loop.
9. Run The Task
If everything has been filled out correctly ORQA should have open the 10 urls for you.
Learn More
Technical users can learn to use ORQA in headless mode here.