Catch block not working

Hi All,

Can someone help me debug my workflow? I have this sequence where I have to log in to a website. I put it inside a Try Catch block but whenever I intentionally enter incorrect credential, the Catch block won’t work and my process would proceed to next sequence. My Catch block should click an item and do a Throw statement. See screenshot. Thanks!

2 Likes

use some log messages to see the branch on which you go.

@Tiberiu_Niculescu,

It would proceed to the next sequence I’ve created. It would totally skip the Catch block I made. Thanks!

Buddy @caduque

i hope you might have added that HomePage may be from element exits or image exists,
instead of them use find element or find image buddy that would throw exception and will get caught in catch block buddy, if the element exists or image exists were used , even though the element or image doesn’t exists it will continue to the next process without gettin g to catch block buddy,

Kindly try this and let know buddy
Cheers @caduque

1 Like

then it means that no exception is being thrown

@Palaniyappan,

Yes bro! My HomePage is inside ElementExists activity in my Try block. Here’s the screenshot.

1 Like

Buddy dont use element exists to get the exception and it wont throw any exception if the element doesn’t exists and will continue with the process without going to the catch block
so use find element activity that would throw error when the element doesn’t exists and will get into catch block buddy
get the output variable from find element activity and put that in if condition inside the catch block buddy @caduque
This would work for sure buddy
Cheers

1 Like

@Palaniyappan,

Changed it to Find Element Exists activity but having error below. How can I solve this?

image

1 Like

use this buddy @caduque
HomePage.IsValid

Cheers

@Palaniyappan,

Buddy! There’s no property isValid here. Am I putting it on the right place?

image

Like this @caduque
that if condition inside the catch block as you have now


Cheers

were you able to place buddy @caduque

Yeah, it was able to go to my Catch block but another error popped up. It’s never ending :smiley:

1 Like

Buddy its already in catch block and i hope we are going for click no activity any how if the element was not found. If thats the intention, we dont need if condition itself buddy, we can directly mention the wrong credential container alone without if condition

Cheers @caduque

It worked! Thanks so much!

1 Like

Great buddy
Cheers @caduque
Keep going

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