This article explains how to build Extractor robots for pages that contain lists of items, e.g. product listing pages.
To learn the basics of how to build Extractor robots, please see Extractors.
To process a list of items on a page, you use the step type "Loop through elements":
To add the step, click one of the items (elements) on the page and click "Add <x> suggestions to selection" in the right-hand menu that pops up:
Now click "Loop through elements":
The "loop" step has now been added to the robot:
Clicking the "step forward" button increments the counter in the step itself (for now, ignore the "No output available" error: we will handle that below):
Looping through elements
The robot we have built above just loops through the elements on the page. It doesn't interact with them in any way, e.g. click them or extract the image.
Let's implement a robot that clicks each image, and - on the product "details" page, extracts the title, price and image. Follow the steps below.
1. Ensure that the robot is stepped inside the loop:
2. In the right-hand menu, click "Click element":
The robot has now navigated to the "details" page of the element it clicked and the clicking of the image is visible in the loop.
3. To extract the title, in the right-hand menu click "Extract from element":
4. Name the output field, e.g. "title" and click "Ok":
5. On the "Results" tab, you can verify that the title has been correctly extracted:
6. Go back to the "Steps" tab and repeat the process for the price and the image. The robot should now look like this:
Tip! To learn how to remove the "£" symbol to convert the price into a number instead of a text, see the "How do I format my output?" section of What should I know about input and output?.
7. Click "step forward" to verify that the robot correctly loops through the "details" pages and extracts the values:
8. When you are happy with the robot, save it. The robot is now ready to be configured and executed to get the full results, as described in the "Executing the Robot: Getting Results" section of Extractors.
And voilà, that's it: enjoy your loopy robot! :)
More on Extractors
To learn about branches and how Extractors navigate pages, see What should I know about the extractor editor? and What should I know about site navigation?
For other specific topics, please use the search function on support.dexi.io.