Check App State and Statements to retry

I am not sure if I am headed down the right path here, but I am struggling to figure this one out as a noobie! I have a Log in button that sometimes the UIElement can’t find; I have noticed that if that button can’t be found, I can refresh the page, and it can see it. What I am trying to do here is if it does fail to retry. I am using a Check App State to wait for the element to appear and then click login; if that fails, I have an IF statement in there, and I have no clue how to tell it to “continue” in the “then” section. Also, within the retry scope section, I have a “check false” section added, but how would I tell it to retry again if “false.” I don’t have an activity that says “element exists” unless it’s in CV scope, which doesn’t work in this scenario.

1 Like

actually if you simply want to retry this click activity if it fails you dont have to do all that

simply do this

  1. enable verify result in click activity

  2. indicate verification target,
    this is the element robot needs to see to verify that the click is successful,
    in your case you can select a button you see after login is successful


  3. change the properties so that retry = True and timeout = “3” meaning if robot doesnt see verification target in 3 seconds, it will retry the click action

the max time in seconds robot will wait is set here common->timeout
its default is 30 seconds (if left blank). This means robot will wait 3 seconds (for verification element to appear), and retry if it doesnt appear , and keep repeating until 30 seconds has been reached

for reference
uipathF.xaml (15.9 KB)



This is most definitely a less complicated way of doing this…Thank you. I’ve been struggling with this button for weeks now trying to Boolean that button.

1 Like

To add a bit extra spice to the mix here. If, for example, if it does timeout, it would fail the process, but how could I tell it to refresh the page and try again if it times out?

ideally you should use the REFramework

but as a starting point you can do the following
put click activity in try-catch scope, then put try-catch in retry scope

in catch section you can refresh the page, then use rethrow activity to throw to error to retry scope,

so the whole process would be like this

  1. try click activity (every 3 seconds) until verification element appears
  2. if 30 seconds passed and no element appears, refresh page and retry
  3. number of retries /retry interval depends on retry scope properties

for reference
uipathF.xaml (20.3 KB)

1 Like

Very cool! Thank you for taking the time to show me this, but I do have a follow-up question. How did you get the sequence in the catches section? This is how it shows for me, and I couldn’t drag the activity “sequence” into catches. Also, no activity would go into the “finally” section, and no conditions would be set.

UPDATE: I see how you added that exception now. Sorry, little delayed on that. But it would still have no “finally” or condition. Or is there something I could use in that section?

You don’t need all this complicated Try/Catch stuff, RE Framework, etc. You don’t need to use Check App State to wait for it to appear before clicking it. That’s the purpose of the timeout of the Click activity.

All you need is a Retry Scope with the refresh and then the Click. In the Retry Scope properties you can control how many times it will try. Retry Scope tries again if there is any error, which is what happens if the element doesn’t appear within the timeout of the Click activity.

The trickiest part is you won’t want the refresh to execute the first time it tries. So you just use a counter and put an If around it and check if the counter is >0 before refreshing.

dont need anything in the finally section

This is an excellent take on it as well! Very much appreciated, and going to give that a try as well!

@jack.chan Thank you so much for your time and patience in teaching this to me. This cleared up a lot of fog on how to set up these processes.

1 Like

no problem

the above method using retry+if condition works too, but having try catch lets you know what the exception is, if you only use retry+if condition you cant do that

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.