Exit loop
FollowExit loop means to stop looping the elements. You can set up how many times you want a loop to repeat in a task. Exit loop is useful if you encounter the following scenarios:
- You will find that the task keeps scraping the last page of data
- You only want the first 10-page data
- You only need the top 5 listing data
- ......
This kind of problem can be solved with XPath if you have a bit of knowledge about HTML (What is XPath and how to use it in Octoparse). If you have no idea what it is, you can make use of the Exit loop feature.
Where do I find it?
It can be found at every Loop Item. Just click on Loop Item in the workflow to open the action settings and find the End Loop at the bottom of the settings.
Please note that "Pagination" is also a loop item.
How do I use it?
Case 1: When you're under a "Pagination" step and you only need the data from the first 3 pages, you can tick the checkbox and enter "3" for the Repeats.
Case 2: If the current page has 15 listing items, but you only need the first 5 results, you can go to Loop Item which contains all the listings to enable the "Exit loop" feature.
During the extraction, the loop will stop if it reaches the number of repeats you enter for the Exit loop.
If you have any questions, you're welcome to submit a ticket to our Support team.
Author: Joy
Editor: Yina