Exception Handling for web applications

Hi ,Main.xaml (14.0 KB)

I am opening www.facebook.com and login to my credentials, i want to handle the exceptions whenever internet is disconnected and invalid credentials using try catch.
please tell how to handle these exceptions.

Thanks in advance.


The easiest way:

Simulate those things happening, so force the exception of the internet disconnection and see what the error in UiPath. It’ll come with a popup that tells you what the exception category is “Exception: Invalid Reference” for example.

You’ll be able to capture that exact exception within a try catch.

For the invalid credentials, it’ll probably just stall and eventually crash, you can do the same simulation thing above and catch it within the try catch or do an image exists to see if the credentials were incorrect then put a decision in your workflow to determine what to do next.

please send me xaml file, how to do the exceptions

Do you have a copy of your xaml file?

yes , i have

Can you supply it?

Main.xaml (14.0 KB)

Main (5).xaml (19.5 KB)

I can’t use facebook at work, but i’ve added two element exists and if statements to your workflow.

One in the open browser, one in the enter details. I’ve also moved your second try catch into the first if statement.

Technically the open browser will throw an exception if there is no internet, but as i am unable to simulate it (can’t change internet settings here) you can use the if statement or use the try catch once you know what exception it throws.

1 Like