Why catch block is not firing when an error occurs?

I am using Find Element activity inside an open browser activity encapsulated in try catch block.
Find Element activity throws timeout error but catch block doesn’t get fired.
How to solve it?

1 Like

What exactly happens. Do you have any activity placed in the catch section?

Kindly check once whether we are running debug mode or in normal mode
Only in normal mode it will catch the exception

Cheers @manzar_ali

Yes I am refreshing the page if element is not found in catch block.But it doesn’t get fired

I have tried in normal mode as well, i am refreshing the page in catch block, but page doesn’t get refreshed when element is not found

You should probably use the retry scope.

What exception did you use to catch the error.Also put log message to see if you catch any error or not. @manzar_ali

cheers :smiley:

Happy learning :smiley:


Though you are refreshing the page in catch block
Is that find element placed inside the try block

Find element is inside the try block,If it fails due to error , I am refreshing the page in catch block


I am using this.

1 Like

This is actually looking fine
can I have a look on TRY block if possible

hmmm Did you try to run it on debug mode ? to see what error did you encounter. @manzar_ali

cheers :smiley:

Happy learning :smiley:


HI @manzar_ali

In Studio, the default running method is in Debug mode. So, even though your activity is inside a try catch, when running in debug mode, if an activity come across an error, the program will stop there temporarily highlighting the failed activity in red as you see right now… So, if this is inside the try catch, what you have to do is, click on the Continue button so that the program will continue the execution from there and start executing the activities inside the Catch block.

Or else, you can try clicking on Step into acitivity multiple times to execute the remaining steps one by one and see whether it goes to the Catch block…

If you want to run it without stopping there like in debug mode, run the full program in Run mode so that it will execute without the debug option and handle this scenario on its own…