Retrieving idx of tables while in Find Children activity

Hello!
I have been trying to retrieve all the tables of this website (https://www.spensiones.cl/apps/carteras/genera_xsl.php?fecpro=201911&listado=8&tipofondo=B) without having to manually datascrape each table . Basically i want to be able to detect all the tables that exist and then transform these into csvs. So far (refer to the image below) i have made a for each child tht does detect how many tables there are on the website and then i created a variable that will have the idx number of each table so that it can iterate. The problem is that in Assign when i put idxIndex to item.Selector.GetTag(item.Selector.GetTagCount-1).GetAttributeValue(“idx”).ToString (which should work I believe) it tells me that Error: Object reference not set to an instance of an object.I need this because later on in the Extract Structured Data ‘TABLE’ in selector i want to put . This would help me iterate through the tables.

Thank you!

Question: Can’t you rely on any other attribute which is not the idx?

idx is known as a non-reliable selector, because it relies on many other elements on screen. Maybe you can iterate through tableNames, or any fixed attribute present on each table.

The error coming up to your screen is due to UiPath not finding the idx attribute, and this can be happening because the table doesn’t really have one (remember idx is an optional attribute).

Hi @ap.macarena.diaz

are you able to get the selector with the property as ctrl id or table row or table col

Thanks
Ashwin S

Thank you!! At the end it was what i was assigning to the indIndex. I was able to fix it by making a variable that inside the for each child became bigger by one.

1 Like

Glad to hear you’ve solved the issue. Keep it up!!

1 Like

just do a while loop with an int variable starting with 1 and inside use a try catch to scrape a table, in the end increase 1 to the index variable, when you get an error then you are over with the tables, dont need find children…