To click a add button in a web page

Hi I have two types of add buttons which are displaying in the webpage dynamically,

I wrote code like below

click add1 button
catch Exception
click add2 button

But the script some times fails when it is trying to click add1 button and in the web page currently it is displaying add2 button, the execution flow is not going to catch block when add1 button is not found

Can anyone help me how to write a logic where i want to click add button in the web page , but the web page displaying dynamically some time one locator i.e. add1 button sometime another locator add2 button

@Vasundhara_Pakkurthi Can you use a Message box inside Catch Block and Check if it is Catching the Error?

I added msgbox inside catch box, but message is not displaying, control flow is not going inside the catch block

@Vasundhara_Pakkurthi Ohh then there might be a Bug in the Try Catch, Have you tried restarting Studio and Check?

Issue resloved , i used ElementExisits activity to solve this issue

1 Like