For Each UI Element

Hi All,

Can anyone provide sample use case on For Each UI Element activity.
Thanks in advance.

Regards,
Amaresh Reddy

Hi,

The following might help you.

Regards,

@amar_Automation

Welcome to our UiPath community.

  1. Use Find Children activity and indicate any drop-down kind of values and it will give output as IEnumerable of UiElements.

  2. And then use For Each loop activity to iterate one by one UiElements from above output.

it is a progress on what we had done in the past with find children and for each

Scenarios:
Webpage testing - iterate over all links, click and check
Webautomations - no select all button is avalable; iterate over all check boxes and check

Hi @amar_Automation,

In one application we had input fields which had no available selectors, however each input field had an icon attached to it, which the robot could identify. We then used the UiElement to iterate (using For each activity) over the required set of input fields via the position attribute found in each UiElement type. Using the position attribute, we could use the click activity and pass an offset value to x or y position.

So, I suggest you try using the UiElement type only as the last resort and if possible look for alternatives where you do find reliable selectors.

For Each UiElement activity is available in the modern experience in Studio, which simplifies the iteration part of the automation.

I have an automation that fills out a form in an application, and one of the steps is to check all checkboxes.