Hi guys,
I an totally new to UIPath and I would appreciate any help with the following:
I am trying to do a check, an if statement to see if an image appears multiple times in a web app. So basically I just need to know if that specific image is present more than once, if it’s just showing once then I plan to do one thing and if it’s showing twice do another. I am using a find image matches activity and a for each to loop through the items in the output from the find image matches activity. Not sure how to check in the if condition.
Many thanks for any assistance provided
Bogdan
Hey,
First you need to define the item type in your for each to uipath. You can do this by going to the propreties of your for each and chosing UiPath.Core.UiElement (In case you’ve already done this good job ! )
Second your if condition can’t work :
The reason is because you can’t convert an UiElement to an integer.
What you can do is change your condition in the if with “element.Count >1”
This will then proceed to highlight all of your items in case there are more than one or else show your message
Hope this helps,
MANDOC Cosmin
3 Likes
Hi Cosmin,
Thank you for your reply. I already found the Count thing in here. The thing is that the for each doesn’t seem to work or the Find image matches maybe doesn’t work, I don’t know.
I only get one hit and then the workflow ends. Any idea why it wouldn’t get all 3 hits in this example?
As it can be seen below I should have 3 hits not just one.
I changed my workflow to the below.
Thanks a lot,
Bogdan
2 Likes
Hey
Yeah that’s the problem with image activities and that’s why you need to do it only if there’s no other option.
I would try to play around with the “Accuracy” property by incrementing and decrementing the value until it finds all matches.
If it doesn’t work I guess you can redo the find image match by cropping a even smaller image.
I can’t really help you more on this since I was almost always able to escape image activities through use of selectors.
Maybe someone with more experience can help you with this problem once they see the post.
Sorry,
MANDOC Cosmin
PS : You did try to see if the image has any selectors containing it ?
Cosmin,
I managed to make it work with the help of Selectors. Thanks a lot for all the spot on suggestions.
Thanks,
Bogdan