Use Find Children Activity in UiPath With Examples

Find Children Activity

This activity allows the user to find similar elements within the webpage. For example, search results provided by a website may have several buttons that require to be clicked to reveal the phone numbers.

The above image is a website that helps to find services related to construction, painting, renovation, etc. Searching for reform professionals in Sao Paulo brings about 34,029 results with each containing 20 results, with 20 “See phone” buttons.

  • Clicking on See Phone reveals the numbers as shown in the image. However, creating automation with 20 Click automation activity and pointing them to each respective button is troublesome. Find Children activity can be used to perform 20 clicks without the need of selecting each button separately.
  • This activity will work for as many buttons that appear on the webpage. It is important to note that, Find Children is extremely powerful and can be used to extract text as well. But to use it efficiently, the user requires to deeply analysis the element and put the right Filter and Selector.

  • The image above shows the Properties Panel of Find Children activity. For the activity to perform desirable, it is vital to put the right Filter and Selector. The final output will save into an IEnumUiElement variable name telephone.

  • Clicking on Filter from Properties Panel opens the Expression Editor which contains the elements that the user requires to find as many times it appears on the same webpage. Identifying this Filter can be tricky and requires the user to take extra steps outside of UiPath.

  • First, the user needs to indicate the entire region of the webpage which contains a similar type of element multiple times. In our case, we have pointed to the highlighted portion as shown in the image.

  • To find the element containing the Orange See Phone buttons, we will use the Inspect option available on all popular browsers.
  • In this example, we are using Chrome Inspect, which the user can open up using Ctrl + Shift + I or right-clicking and selecting it. This will open up the Inspect element panel in Chrome.

  • Click on this button or use the shortcut Ctrl + Shift + c, which will allow you to point to an element to be inspected.

  • Upon pointing to the See Phone Button, the Inspect element panel shows the following information.

  • The information highlights that the button is stored inside the class = “btn btn-md btn-primary btn-icon btn-block”.
  • The same can be verified by inspecting the other buttons to understand the repeating element, which is inevitably the element of interest. Moreover, the entire class is present inside the tag “a”.
  • Using these two as filters will enable Find Children activity to identify all the See Phone buttons on that page.

  • In the Properties panel, we can also adjust the Scope of the Find Children activity.
  • In our case, we are using the first See Phone’s Button as the filter and by selecting Find_DESCENDANTS, we are asking the activity to look for descendants of the same selector.
  • This wraps up the entire configuration and adjustments for the Find Children activity.

  • Now, we will use the For Each activity to create a looping sequence with an integrated Click activity, which will make the Robot click all the See Phone buttons on the webpage, one by one.
  • It is important to point out that, we are selecting For Eachitem” with the variable telephone, which is the output of the Find Children activity.

  • In the Properties Panel for For Each, the user needs to change the TypeArgument to UiElement to match the variable type of telephone.

  • Finally, we will use the Click activity and pass the “item” as Element, instead of choosing a selector manually. This is because we already have the selectors identified and stored inside the telephone variable.