How to loop through IEnumerable<UIElements>


#1

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.


#2

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

Regards,
Dominic :slight_smile:


#3

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?


#4

@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.

Regards,
Dominic :slight_smile:


#5

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 .


#6

@ddpadil It worked :+1: