None of the existing forum questions where useful. I’m not running in debug mode.
I’ve reduced my scenario into something simple to test and this is what I found:
This works. It goes into catch and displays the error message. Click on element will always fail for the purpose of testing.
Try_catch
Try
Click on element
Catch
System.Exception → Message Box: “Error”
This does not work. It never goes into catch no matter how many exceptions I add to Catch.
Try_catch
Try
Sequence:
(any action)
Click on element
Catch
System.Exception → Message Box: “Error”
I need try catch to catch the exceptions that may happen inside a sequence. I have no use for try catch If I can only use it for one action at the time.
Should I just try to use Global Exception Handler instead?
@FedeRattay As per my understanding even if you use a sequence also, if any of the activity fails then it will go to catch stage.
Here in the sequence scenario, can you confirm whether click is happening or not. Maybe you can use debug, stepinto, and verify whether the click step is successful or not.
Else if you need to perform more number of steps, maybe you can try for a invoke workflow as well as in the doc below.
for testing purpose, just put a throw activity inside that sequence. It should lead to catch block being executed.
Make sure you have added proper catch exception.
@Nithinkrishna @Rahul_Unnikrishnan Click step is not meant to be successful. I want it to fail to test the catch. Catch works in first case but not in second.
The exception itself I can Catch with System.Exception or Node not found. The issue is not the type of exception itself.
Just now i checked the flow with try catch usign sequence. Inside sequence I added a writeline and click activity. Whenever if click element is not found it is moving to catch block.
Here in your case what you can do is selector is properly allocated to the click activity.
For example , suppose if you want to click on Submit button, in the selector plz include that attribute which gives the button label as well.
Run it in debug mode->Enbale highlight->stepinto
check in the click activity where the action is performing. I hope you are using the click activity inside the applciation scope.
This works fine. I do it all the time. You’re doing something wrong. Are you in Debug mode? If so, the fault bubbles up through all the containers and you have to click Continue multiple times before it jumps to the Catch.
@FedeRattay Did you try this? Please update if works or not.
You need to clearly monitor whether the action is performing in the screen or not using the debug method
So weird thing. I copy pasted the whole bot to a new file and it works now. What I noticed is that the new file has the option “export as template” next to save and the old one doesn’t.
According to what I found online that’s because the old one was made with a template and I belive that indeed it was.
Altough I now know how to fix it I don’t understand why does this happen. Is this a bug?