Try Catch repeat from the last activity

Hello guys. I have 2 different try catches. The first one has 4 clicks in it that has a chance to throw an SelectorNotFoundException. I wish that if it throws that exception, it repeats the clicks from the start, but have literally no idea how to do so.
The next try catch has some clicks and type into’s that need to be on a loop. But they to have a chance to throw the same exception. I wish, that when they do, the try catch starts them again, but keeps then on a loop. Any Ideas? Thanks for the help in advance! :slight_smile:

@Povilas_Jonikas

For the first case you can try keeping the try catch inside a retry scope and use it…

For the second…I dint get you when you say from the loop?

is it that if it fails in loop it should retry from same number again?

if so use the same try catch and retry scope approach inside the loop

cheers

Hello Povilas,

You can use the try cache inside the retry scope activity. In the case of the SelectorNotFound exception, inside the catch, create a Boolean variable with the name ‘NoException’ and assign False to it.
Now go to the retry condition, Add Check true activity, and inside that keep the ‘NoException’ variable.
You can define the number of retries as per your need in the retry properties.

Ok, thanks guys, I’ll try ur suggestions and let you know in a bit :slight_smile:

1 Like

Im sorry guys for the late response. I just tested it and it’s not fully working yet.


The screenshot that I took has the activities that could go bad highlighted. The first square of activities dont always throw a error. It just goes bad. I would love to, that the robot would work with element exist’s.
While the clicks are doing their thing, the robot would always check if an element popped up, if so, it would close it and continue with the sequence. Is it possible?

Basically, when I did your suggested steps. The robot did turn off the pop up window that acts like an error, but he didnt repeat the sequence, even tho I have it in retry scope

@Povilas_Jonikas

In the catch block you have to rethrow the error or else as the error is handled retry will not try it again…

Ideally if you are using try catch only to catch exception then you need not add it at all…directly add only a retry scope so that if there is an error it starts again from
The start of those activities

Hope this helps

Cheers

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