Try Catch a miss "click activity"

Hello There,

I try to Catch the exception when Uipath fail to click a button on a website.
I’m only looking for the exception name to use in Try Catch not a solution to fix this miss click.

I already tried with “System.SystemException” but nothing is catch.

Any ideas please ?

Hi @anon52976114

please use this for checking and catching selector issues in click

UiPath.Core.SelectorNotFoundException

if you want to catch all types of exceptions then use
System.Exception

cheers

@anon52976114
System.exception is the correct exception type

Hi @anon52976114 can you send your code?

I’m trying it, let you know asap. Thanks for the help

1 Like

Thanks, I will use it one some other try catch then. I need a specific one for this issue

sadly not, I’m working on a computer without internet on it
thanks for the help anyway

Sorry, it’s finaly not solved yet …
UIPath still stop the execution without using the Try Catch …

Hi @anon52976114

Can you confirm that have you replicate as same as i suggested below?

Step 1 : Use Try catch activity and Inside the Try use click activity (Refer Screenshot)

image

Step 2: In the Catch Block Select ySystem.Exception (Refer Screenshot)

image

I’m pretty sure if you done like this it will ot throw / Stop while execution

Regards
Gokul

Hi @anon52976114

I would suggest you to run the steps in debug mode and add a break point and then from the local panel you can open the exception details and find the exception that and the type of exception

cheers

Yes I just did a simple test to reproduce your exemple and it’s still doesn’t work. I’m doing some tests

I never used Break point yet so I let you know after few tests . Thanks

Hi @anon52976114

you need to right click on activity and select add breakpoint and once bot reaches there it will pause you can do step into and after failure go to local tab on left

cheers

Can you share the XAML file Screenshot @anon52976114

sadly no I can’t, I’m using UIPath on another computer.

ok so after some tests the exception trigger seams to be :
UIPath.UIAutomationNext.Exceptions.NodeNotFoundException

but I still don’t know why it’s not catch by the try catch (system.exception)

I’m using exactly the same exemple as @Gokul001 ask to do.

Hi @anon52976114

Is the bot failing there or its moving smoothly. Inside catch you have to do some activity to check if catch is working or not. You can add a log message as well to check if its working

cheers

Yup,

my “try” only contain a click activity targetting a real button hide behind a Popup on a website.

I set two catch :

  • System.Exception
  • NodeNotFoundException

both contains a differents log message.

the bot take a break on the click activity, show a red exception (UI not found) and show a button “Continue” if I continue the exception is catch and the message is shown and the bot stop

Hi @anon52976114

Then it is working right. if the right log message is coming up. You have to add NodeNotFunctionException on top and then the system.Exception. Sequence matters

cheers

I will double check that tommorow, there is something I don’t get.

I don’t want to received any exception and stay stuck on it.
I’m using a try catch to catch it and do something if the exception is know.

but maybe it’s because I’m using the “file debug” blue button on a test file ?
it’s not the main file of my project.