Best practice to loop trough a website data table

Hi, I wish to loop trough a website that has a data table.

So it looks something like this:


Button 1 | Button 2 | Button 3

Text2 showing how many rows

First row with headers
Second row: ID | Text3 | Text 4
Third row: ID | Text5 | Text 6
Fourth row: ID | Text8 | Text 9
And so on…

My wish is to use the Get Attribute activity and grab information from the rows by using a for loop, I have created a variable for the selector which starts at 9 (so the first row of data) and then increases for each loop.
There are different amount of rows for each page that I wish to loop trough.

So far I have tried to data scrape and create a data table which I the loop trough with a for loop but I end up with something like 40 rows in my data table but it should be for example 19.

Thank you for any advice!

Hi @Eric46,

First, you need to troubleshoot why you are getting 40 rows when you expect 19.

Is it because the data is extracted incorrectly leading the 19 rows to double which makes it 38, plus a header and a blank row that brings the overall count to 40?

If not, would it possible for you to scrape the Text 2 value that indicates how many rows that page contains and then set a condition in your Do While to exit the loop when that limit is hit? This way the solution would adapt to different rows on each page. Would that work?


1 Like

Thank you, I was able to solve this issue by scraping the Text 2 value and setting a condition in my while loop.

1 Like

Excellent! Thanks for the update and marking the post as solution! :slightly_smiling_face::+1:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.