Find Element Problem

Hi to everybody,

I am having a problem using a find element to save the UiElement into a variable, I want to use that variable with the stored elements in the List of items but the following error shows:


I changed the variable type to System.Collections.Generic.IEnumerable<UiPath.Core.UiElement> and the error dissappear but It shows agains once it tries to run.

not sure I fully grasped the issue, but are you using the “Add to collection” activity when you’re adding your element to the list of UiElement ?

1 Like

I have not used that activity, I was looking for it but I think I dont have the package. I’ll look for it and give it a try, I’ll post an update.

Thanks :slight_smile:

1 Like

I had to use a lower version of the system packages for the activity to show, tbh idk how it works im still looking at it.

I want to explain fast what im trying to do and if the solution I had in mind could work or not.

I have a table that 100% wont change the position of the clickable icon, I used the find element to save that icon for the for each to use and loop. Im having this problem and as I also had a problem with this new activity, I was thinking if with dynamic selectors I could achieve the same result.

Thanks for the help and sorry for the unstructured rant, have a good day :slight_smile:

1 Like

In higher versions it’s called “Append Items to Collection”! Sorry, I forgot to mention it :slight_smile:

To use it, you’ll need to create your collection (a list of UiElement, from what I understood), then you can set it like this:

And you can configure the Items part as follows:
So you’ll have to put this part in a loop, but from what I understood you already have a loop that you’re using to get each button so I guess it should work (with some doubts, as I can’t guarantee I fully grasped your issue :smiley: )

1 Like

You can use the Find Children activity to get all the buttons and it automatically returns an array of the UI objects. Keep in mind it’s usually necessary to change the Scope property to FIND_DESCENDANTS.

Im going to give it a try and I’ll be back with an update, thanks for the help :smiling_face_with_three_hearts:

1 Like

I created the collection and the items I used what I saved in the variable extracted from find element, the error message from before dissappeared but a new one appeared:


It says that the value is null, If im not mistaken it should contain the iEnumerable atleast right? The scope selected is in the whole workflow

Did you change the Find Children’s Scope property to FIND_DESCENDANTS? How do you have the selector and filter configured?

By the way if you’re just trying to loop through objects on the screen you should be in modern (which you should be in anyway) and use the For Each UI Element activity.


You need to intialize it

also may I know why you are using loop again as it is already an IEnum type and you have list…May I know what you want to acheive



So I have a table that is 100% staying where it is, aswell as the icon I need to click. My train of thought here was to save the Uielement into a variable, for the for each to use. Now that the for each has this element I want that for each element some actions be performed, which would result in the robot going through all of them.

I may have made some mistakes along the way, still learning so any tip/advice is welcome, thanks for the help guys :smiling_face_with_three_hearts:


Then leave using append again with find children…use the filter in find children to get what you need

And can use for loop and your click or other activities inside

Apart from that for each ui element would be a better option as well


Because the Find Children gives you a collection that you can loop through, there’s no reason to add them to a second collection(list). Also, you haven’t answered if you set the Scope property for Find Children to FIND_DESCENDANTS.

And you should set your project to modern, and use the For Each UI Element activity. It’s literally designed to loop through elements on the page.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.