For each UI element. Sometimes the file is downloaded twice or three times instead of just one

Hello guys,

I use for each UI element and activity to start a download is clicking the current element.

The problem is that sometimes the automation downloads the same file 2 or 3 times (it downloads all of them but sometimes the issue is that it downloads one file twice and that is not needed.

How do I fix it? this is how it looks:

Hi @anon40731888

You don’t need to use another for each
Drag the if condition into the above for each and remove the break.

What do you mean another for each?


The image you have shared has two for each loops
so delete the repeat number of times activity and drag the if condition in that activity to the for each ui elements activity.

But this Repeat is so that I can make sure that the file is downloaded.

It checks if the file is downloaded and if its not then it tries to download it again why I’m wrong?


My bad, I forgot that you are using studiox

1 Like

I understand that in red is fileexist = true but what is in yellow?

OK, can you please post new screenshot? I see the “While” activity for the first time and I’m not sure how to put it correctly


Simply use this as reference:
Main.xaml (29.1 KB)

OK I will try in 10 minutes and get back to you if needed thank you be right back

I think that the error must be elsewhere because it downloaded the same file twice again.


I have updated the flow. Check again once.

I found the error it was something else I fixed it by adding check app state before the for EACH UI ELEMENT

What was wrong:

When I clicked a button then the elements for “for each UI element” appeared on the screen and the automation started downloading them but then for some reason the subpage was refreshing in the middle hence it came back to download them again

Still THANK YOU <3 for teaching me while activity you are great!

1 Like