How to cover all kinds of exception

(sorry not good at english, japanese follows after english)

Do you know how to cover all kinds of exception (such as exception caused by UI automations)

I’m developping business automation scenario.
When to implement exception handling, i’ve got issue for catching all kinds of exception.

Usually I add “System.Exception” generally, but then, some exceptions in UI automation will not catch.
And there are many kinds of exception, so when unexpected exception thrown, scenario will stop.

I’ll appreciate any answers.

エラーハンドリングを実装する際、System.Exceptionでカバーしきれない例外(UI Automationによって発生する例外など)をキャッチする方法はありませんでしょうか。


Basically, Try Catch can cover all exceptions using the generic System.Exception. Make sure that for every activity you used, the ContinueOnError property is not set to true


Hi there…!

I am guessing you know that try catch activity will capture any UiAutomation exception that occurs during run-time.

But, if you are looking to visualize the kind of exceptions that might occur and want to ‘catch’ or prevent it then there are many avenues.

I will mention some that are relevant to UiAutomation:

  1. Use multiple redundancies like On element appear with repeat forever set to ‘False’ and continue on error property set to true and storing the result in a UiElement and retrying it until the UiElement output is stored (you can keep a maxRetry number)
  2. Try using simulate click for background automation so that even if the window hasn’t come into focus or on top the click activity will work.
  3. Maybe use hover, set focus etc before actually clicking or typing on it… Also on element appear make sure you check visible and active checkbox so that UiPath waits until the element is loaded and displayed.
  4. Also (this might slow down your bot a bit) set everything from ‘INTERACTIVE’ to ‘COMPLETE’ so that the bot doesn’t miss out on background events loading and click on the element before the even might have loaded.
  5. Maybe if the webpage/UI isn’t subject to change then in the catch block keep image based automation if the UiAutomation fails.
  6. Make sure you dont have any ‘idx’ attribute while finalizing the selectors.
  7. If it’s an iFrame automation then better extract the ‘src’ attribute the source and launch it in a different window and perform Ui Operations so that the results are updated in real time without hiccups.

These are a few I can think of right now.

Will add more in due time.

Regards :slight_smile:

1 Like

I appreciate your response.
I didn’t know that all kinds of exceptions can be caught when use “System.Exception”.

I appreciate your response.
I didn’t know that all kinds of exceptions can be caught when use “System.Exception”.

But it will be so helpful when we implement exception handling. Thanks for detailed description.

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