How to check if a screen has been loaded

Hi guys,

i am looking to check if a screen has been loaded, if it hasn’t then to click the button again, if it has loaded then to carry on with the process.

Is there an activity i can use for this? i have thought about an If statement but it would be too slow.

Is there anyone that has a better solution that can help me?

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.

2 Likes

Hi,

I have tried using the retry scope below
image

So the button i need the bot to press in the action box and the screen it should open is in the condition box, is that correct? @Anthony_Humphries

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.

perfect, ill give that a run and let you know how i got on,

thank you @Anthony_Humphries

@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 handle failures in a Catch block, and send an email with details on the failure using one of the email activities in UiPath.

by catch block do you mean try catch? @Anthony_Humphries

I mean the Catch section of the Try/Catch.

ok so i put the retry scope inside the try catch in the finally section i add the email activity and the details of the email i need it to be sent to?

@Anthony_Humphries

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.

ok cool so i have put this work flow together, could you guide me if i am missing anything.

For catches i have put down system.exceptions.

@Anthony_Humphries

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.

thank you @Anthony_Humphries got it all sorted