How to use "find children" for each of the children (UiElements) found via "find children"

I have used “Find Children” to find an enumerable of UiElements. For each of the UiElements in this enumerable, I need to find the text for one of the children elements (as shown in the example below). I thought that I can use “Find Children” again for each of the UiElements. But I am a bit confused about the SELECTOR I need to use for this inner “Find Children”. I tried item.SELECTOR.ToString as the select. It passed the validation. But when running the code, the studio says "Find Children: the SELECTOR is not valid.

Below is an example of what I tried to

  • text1text2
  • text3text4
  • text5text6

The first “find children” allows me to find the three list items as UiElements.

For each of these list items, I need to get the text for the first span (class=“s1”). I used “For Each” to loop through each of these list items with no problem. But to use “Find Children” again for each list item what should be the selector and the filter for “Find Children”?
Shouldn’t the selector be Item.SELECTOR.ToString?
Shouldn’t the filter be “”?

Please advise. Thank you very much.

The HTML code I gave as an example was converted to a list of text (text1text2, etc.).

So, please allow me to try to give an example without HTML code.
Level2 Item1 text1 end_of_item1 Item2 text2 end_of_item2 end_of_level2
Level2 Item1 text3 end_of_item1 Item2 text2 end_of_item4 end_of_level2
Level2 Item1 text5 end_of_item1 Item2 text2 end_of_item6 end_of_level2

@SJ_LIN I have a response from some internal devs that the answer is to just pass the element for the second find children as the target rather than the selector

Thank you, Kristina.

But after trying to pass the element found in the first “find Children” activity as the target element (leaving the target selector blank), I encountered an error message saying “The selector is not valid”.

Find Children: The selector is not valid

Can you please ask your internal devs for advising how to proceed?

Have you tried For Each UI Element? It’s much easier to use.

1 Like

Yes… the first loop indeed was For Each UI Element to process the children elements found by the first “Find Children” activity.

The issue is what should the target be in the second “Find Children” activity to process the details of each list item (an UI element)?

That’s not how For Each UI Element is supposed to be used. You don’t need Find Children first. For Each UI Element replaces Find Children.

It sounds like you are looping through a set of UI Elements, and for each one you then have to loop through its elements too.

So you embed the Find Children in the For Each UI Element, and reference the Current Element as the parent container:


I just figured out you may be able to use CurrentElement from the parent For Each UI Element as the selector for an embedded For Each UI Element.

For the inner FEUE’s Strict Selector I was able to put CurrentElement.Selector.ToString

Maybe that would work to set the container for the embedded FEUE.

EDIT: I tried to make that work but it doesn’t seem feasible. Somewhat of a deficiency of For Each UI Element that you can’t designate the parent container with an input variable like you can with other activities.

Let’s try this. I will use a real example to explain what I am trying to do.

The first Find Children is to find all the games the Florida Gators played.
The second Find Children is to find out whether the Florida Gators has won or lost in each game.

Because each game has different parts (home or away, opponent team ranking, opponent team name, win or loss, scores), I thought to find the part about win or loss, Find Children is a proper activity. If it is not, what will you suggest to do?

Hi @SJ_LIN use find children like and in for each loop use a get attribute activity for the attribute value

Thanks for reply. But Get Attribute does not work because each game has different parts (home or away, opponent team ranking, opponent team name, win or loss, scores) and each part is a different element (the tag).

Okay you can put the tag name in get attribut that you are getting for different values

Thank you. Each game has many child elements like home or away, opponent team ranking, opponent team name, win or loss, score. Each of these child elements is a span tag. In this case, how can we use the tag name in “get attribute”, when all these child elements have the same tag?