"Exit 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 find that the task keeps scraping the last page 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 to find it?
It can be found in every step of "Loop Item". Just double-click the step name in the workflow to open the action settings.
Please note that "Pagination" is also a loop item.
How to 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 20 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.