Looping Through Tags with Different Classes

Looping through tags with the same class is a common scenario, but not the most simple one you might run into. Often it will be necessary to loop through tags which do not all have the same class. An alternative scenario will be explored here.

The For Each Tag step is very efficient in most of cases where For Tags With Class fails. The For Each Tag step loops over every one type of tag, which is directly inside the found tag. It does however take a little more configuration than just right click and insert. Here is how to use it.

The For Each Tag step can be used to loop over each tag of a given type, which is directly inside the found tag.

Above, the found tag contains three div tags, but they don't all have the same class. This is a scenario that the For Each Tag step can handle.

First, an empty step is inserted with and the For Each Tag action is chosen for it in the Step View as shown below.

The For Each Tag step is configured to only loop over one type of tag.

Then, the found tag is selected from the page view and finally the type of tag to loop over is chosen from the Step Action View. In the case above it is the div tag.

Finally, steps are added after the For Each Tag step. These steps are repeated for each iteration of the loop.