Use another type of click if the previous one didn't work


The idea is the following. I generally have 3 types of clicks: Click by selector, Click Text and Click Image. I want to design it so that if Click didn’t work then to use Click Text. If Click Text didn’t work then Click Image. And if the last one didn’t work then throw an exception.

What is the best way to organize it?

I thought of a loop but it’s unclear how to understand whether the click was performed (if I have two press two buttons in a row, for example).

There are no arrays of activities :smiley:

Try to use Pick activity it seems best fit to your scenario, see this -

@PrankurJoshi Thank you, I’ll have a look at this :slight_smile:

1 Like


I think the Pick Activity will not work here, because any how If you use Click, Click Text, Click Image, All three will start at the same time, Let us take it performed Click Activity first, other triggers will be cancelled automatically, And if the Click throws an exception it wont continue Further.

You can try like this,

  1. First you can try by using Click Activity, Add Click Activity in Try Block, Create one bool Variable in Catch block Lets Take boolError=True. OutSide TryCatch check The BoolError is False or True.
  2. If its false you can continue with further Proocess Else, Make the boolError=False and Connect Else Part to Try Catch Block Containing Click Text Activity, there Also Add boolError= True, OutSide Try Catch Block Check the Value of boolError,
  3. If its False Continue Further Process Else Make the boolError=False and Connect it to TryCatch Block Containing Click Image Acticvity. Here also do the Same thing.
  4. At last check the Value of BoolError, If its False Continue Futher Process Else Throw the Exception.

Note: Better Try with Both the Ways, If any one works then its good :smiley:


1 Like

@MAHESH1, Yeah, thank you for your reply. I thought of something like this as well :slight_smile: the workflow is gonna look kind of bulky maybe haha I thought it would be possible to make something short, nice and efficient at the same time :smiley: