How to click each checkbox on a for each

He just means use an Assign activity to set the counter variable to 1, then increment it each time.

Again, though, it’s much simpler to just use Find Children to get an array of the objects.

Here are the keys to making this work.

In the Find Children activity, you indicate the container that holds the checkboxes you want to check. This is the selector. In the filter you then designate that you want only the objects with type=‘input’ (this depends on the actual web page you are using, you use UI Explorer to click a checkbox and see its selector to find an appropriate filter). Also, make sure to set the scope to FIND_DESCENDANTS. Lastly, the Children property takes a variable of type system.collections.generic.ienumerable(uipath.core.uielement) - in other words, an array of uielement objects. Easy way to create this variable is to click into the property and press CTRL+K then type the name of your variable and press enter. This will automatically create a variable of the correct type (array of uielements).

image

Then in your For Each, you reference the same array you put into the Children property above. Make sure to change TypeArgument to uipath.core.uielement:

image

Then in the Check/Uncheck activity, you pass the loop’s variable which contains the uipath.core.uielement object you want to click:

image

1 Like