Is it possible to traverse through the selector tree?

If I have a selector, lets say its pointing at a table on the screen, and I want to traverse through that table just by using the selector is it possible to get to the data within the table?

So if I have the table selector, is there a way using just or Uipath to traverse through the table? Children of the table would be the rows, and the rows children would be the data within the row in each column. If I used a find children activity to retrieve the rows, could I then somehow using “row” as a variable name get to it’s children without using another find children activity? row.child? selector.down one on the tree?

What are some ways I can traverse through the selector tree.

the uielement API has following similiar to a find children. Example code for retrieving the td elements as List(Of UiElement) from a row as of datatype UiPath.Core.UiElement:

uiElement.FindAll(FindScope.FIND_CHILDREN, new Selector(“”), Nothing).ToList
the data you would get returnd with get attribute activity or by API uielementvar.Get(“innertext”).toString

However its not recommended to setup the retrieval in that way due it is less easy to maintain e.g. with different team members with different skills.

Following options are available as well:

  • Datascraping and finetuning the ExtractMetadata XML
  • iterating over the rows with a dynamic selector on idx=‘rowno’ and using find children for the cells
1 Like