Use Retry Scope. Here, you can set how often you do an activity, then use an Element Exists activity to look for something on the webpage that should appear when the button is pressed. If it doesn’t appear, the Retry Scope will try to press the button again.
Essentially, yes. You’ll need some element from the screen that will pop up in the Element Exists box, such that the element does not exist on the screen where you pressed the button.
@Anthony_Humphries
If i wanted the bot to send an email for when the button failed and couldnt load the screen how would i go about that? i am a bit lost
You can put it in the Finally block, but then you won’t be able to report the exception. The Finally block will always be run whether there is an exception or not.
If you want to send an email about the exception, you’ll need to do it in the Catch block.
@Anthony_Humphries Sorry am not understanding this, i want the bot to attempt to click on the button at least 3 times and if the next screen doesn’t load then i want an email to be sent.
Do i need both a try catch and a retry scope activity? could i use try catch in a loop and then on the third loop have a email sent?
The Retry Scope is used to attempt to press the button 3 times. If the element you’re looking for doesn’t exist after the 3rd try, the Retry Scope activity will throw an error, which leads the process to the Catch block. In the Catch block, you can send an email detailing the error that occurred.
The Retry Scope should be in the Try block, and the Send SMTP activity should be in the Catch section, rather than Finally. Other than that, it looks good to go.