Today I will show you how to work with Find Children activity! For those unfamiliar with computers’ jargon, this activity does not help parents to find their babies.
Most of the elements that you see on your computer screen are somehow nested. An element that contains other elements can be seen as a parent element in relation to them. And the contained elements can be described as children.
For example. This is a table:
some | cool | table |
---|---|---|
with | some | content |
A table consists of rows, each row consists of cells, each cell has some content.
Such table can be represented by a structure with levels, similar to a family tree:
- Table
- Row 1
- Cell 1
- text in Cell1
- Cell 2
- text in Cell2
- Cell 3
- text in Cell3
- Cell 1
- Row 2
- … and so on…
- Row 1
Row 1 is a child of Table and also parent of Cell1, Cell2 and Cell3.
So, Find Children activity gives us the power to find elements, contained in specific element. One of the coolest feature of this activity is, that it can not only search for children of the element, but also for grandchildren, and great-grandchildren etc.
It returns an Enumerable of UiElements, ready to work with. For example - you have a list with some text and checkboxes, and you want the robot to go and click all the checkboxes one by one. This can be done easily!
How to use Find Children activity?
Let’s explore this activity by its properties:
- Selector - indicate selector of the parent element. This can be some frame or part of window or website.
-
Scope - use:
- FIND_CHILDREN to search only one level down the tree. (so only rows for table)
- FIND_DESCENDANTS to search in all descendant (till all ending branches of the tree)
- the three other options are still not well documented by UiPath and I personally did not use them. Did you?
- Filter - selector to filter the children. Imagine you are looking for all images on a website. Website window will be the Selector property, and to Filter, you type:
<webctrl tag='IMG' />
You can use UiExplorer to tune the Filter property.
Create new output variable for the children. (for example: children_output
)
You can check if some children were found by Write Line/Log Message:
children_output.Count.ToString
Good example of this activity can be found in ✓ RPA Challenge 5 - Explore new music
Here is this activity used to click on all download arrows.
If you have any questions or issues, please reply!