Help with For Each Lop

Hello, all! This would be my first time posting here and I wanted to seek the help of the community. I am starting on a project and I am facing an issue currently that I cannot figure out.

This is within a For Each Row sequence:

  1. Read “ClientNum” from SQL Table
  2. Type ClientNum onto web page
  3. Click “document” tab" under Client’s account
  4. Verify if a particular document exists
  5. If it does exists, great, log as success and move on to the next

And here is where I am getting hung up or making things more complicated
6. If the document is not present, I want to go back to the beginning of that iteration, go through the same steps again and check to see if that document is present.

How would I, based on the if condition, go back to the beginning of the loop and type in the same iteration and go through the same steps to check it a max number of 3 times? I want to check it a max number of 3 times before failing out and then moving onto the next iteration.

Thank you all in advance!

Unless I am misunderstanding, you could do a For loop with an if statement in it, if the document exists use a variable to say “Success” then a Break activity. after the for loop check for the variable you used to say “Success” and if it’s blank then error


Welcome to forums

For Retry the same block whenever you didn’t find the element, you can try with Retry Scope

It will Retry 3 time until the element is appeared, If appeared at 1st time then it will not retry

Hope this may help you


Yes, a Retry Scope may work in this instance. Make sure and put in the number of retries and retry interval (can use 00:00:01 if wanted)(which is one second)

Hi @some_guy , You can check for max 3 times fails by adding "Do While " inside you for each loop. Create a Count variable and increase by 1 count = count+1 on every fails and when Count > 3, you can stop.


Hello! Thank you all for your suggestions! I will try them all and get back to you! Thanks for the quick replies

1 Like