I’m running a do while loop with a try catch inside of it.
I want it to keep doing the process until the submit button is found, or until the exceptionCounter is equal to 2.
I only want it to try the process twice, and if it doesn’t work I want it to throw an exception, and shut down the whole workflow.
I can’t seem to get my condition statement right.
The two conditions are
No SubmitFound OR exceptionCounter <=2
So I want it to keep doing the loop if the Submit Button is not found, or at try it twice.
When I do that, it just keeps going and going and going. It never breaks out of the loop.
I’m assuming this is because it examines this statement and it see’s that the submit button was never found, even though exceptionCounter is not less than or equal to 2 any more, and it has surpassed it making that statement false, NOT submitFound is still true, so it just keeps going.
So how am I going to do this.
Here is my workflow. It’s for completing ticketing. Sometimes it freezes up and doesn’t go to the next page where the submit button is found. So it tries to re start, and if it’s still freezing up, it just closes everything out.
What I ended up doing was different, but that is the answer to the question I asked.
I have to end the program, so I stayed in the loop until exceptionCounter <=2
Then once out of the loop I examine if the submit button was ever found, and if it wasn’t I throw an exception.
If you use AND then both of the statements have to be true before it will break out of the loop. So if the submit button is found on the first go round, it will just keep going until exceptionCounter reaches 2 right?
Hi there. I suggest using the Retry Scope. You won’t need to use a counter and it will only retry a certain number of times. Then, use the Element Exists or Is True in the condition part of the Retry Scope; it will retry until the condition is true or hits the number of retries that was set. (also, usually you want to set the time before retries to 00:00:00 unless you need a delay for some reason.
No, it will exit as we are using a Not before the found.
See generally with elementExists the output is false if not found. In that way if you see the logic it will exit if found and continue for 2 times if not found then exit.
See, it will do once without the condition check and the counter become 2 if exception/notfound
it will try again and then if exception/notfound counter becomes 3 and it will exit.
And a retry scope is also suitable as Clayton mentioned.
Hi Nadim, I want to do a similar thing, but only change is I want the do while loop to exit if the either element exist is true or the count turns 3. I tried using the condition you have shared but that doesn’t work for me.