Posted: 15 May 2018 17:40 EDT Last activity: 22 May 2018 13:38 EDT
html table - TableSection AbsoluteCount
We have a html table and we would like to iterate through all the rows. We have a TableSection set up using the Table Designer. We use the AbsoluteCount to determine # of rows for a forloop. The issue we are encountering is that the AbsoluteCount does not necessary returning the true # of rows of the table.
For example, a table has 200 rows for that particular TableSection, and AbsoluteCount only returns 15. Also, if we run the automation multiple times, the AbosluteCount returns different number each round.
Yes, all rows matched. So, if I get the InnerHtml of the table, all data are there, but when it goes through the AbsoluteCount, the returned number (# of rows) is less than the actual table. It seems like the automation goes too fast that AbsoluteCount is executed before the table is fully loaded.
One trick I have used for some tables is to setup a wait for the count to be stable.
Add a ForLoop and set the limit property to the number of milliseconds you want to wait divided by 250.
For 10 seconds (10000 ms), you'd set the limit to 40.
Before entering the forLoop, grab the AbsoluteCount and store in a variable.
Inside the forLoop, pause for 100 ms.
Next, get the AbsoluteCount and compare it to value in the variable (the one we grabbed 250 ms earlier).
If they differ, update the variable value to the new AbsoluteCount.
If they match, you may break out of your loop.
I actually like to use a boolean here and make sure it matches at least twice before I break out, so instead of breaking immediately, set a boolean to True and return to the forLoop. When the variable is True the next time, you may break out of the loop.
You are essentially waiting for the AbsoluteCount to stop changing.