Forum Discussion

saranoor's avatar
saranoor
Frequent Contributor
5 years ago

If object exists then click on it an, if object does not exist go to next step: how to achieve this.

How do I do this " If object exists then click on it, if object does not exist go to next step " 

I am attaching the test screenshot in aword doc

 

5 Replies

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Well...  You don't need the "if not exists" line at all...  You can replace that with the "Else" operator... then you should actually "outdent" that entire block of code to the left so it executes on the same "level" as your if operater... otherwise...  I don't see anything wrong with what you posted....so... that means something is not happening that you are expecting to happen....  Please give us more details on what is going wrong.

      • saranoor's avatar
        saranoor
        Frequent Contributor

        If I right click and I select Insert New Opeartion I see Else condition but it has a red X on it.WhenI run the test it is catchinga n exception at that line.

        Attaching teh screenshot again with Else clause added.

         

        The earlier script (Before adding else) was works fine if the object "YES "is existing but it stops and does not execute when object "YES" is not existing.

        Adding the file again with Else screenshot