How to loop through IEnumerable<UIElements>

I am using the ‘Find Image Matches’ entity and the output is of type IEnumerable
How can I loop through the collection and convert each element into an image?

Expecting to save all the matched images to a folder location.

@Aswathy,You can use For Each activity itself. Change the typeargument in properties to IEnumerable (Uielements)

Dominic :slight_smile:

Thank you for your response.

I’m actually facing difficulty in downcasting the UIElement to Image, so that i can save that image to a location.
How will I downcast?

@Aswathy, Sorry I dont have any idea ! Lets wait for someone to answer. If you get a solution please post it here that would be more helpful.

Dominic :slight_smile:

Hello there @Aswathy ,

You can use take screenshot activity and in target properties “element “ pass item of foreache and create output variable for it ,this will return uipath.core.image type which can be used in save image activity .


@ddpadil It worked :+1:

1 Like