Forum Discussion

SumanthKotha's avatar
SumanthKotha
Occasional Contributor
8 years ago

Object is invisible hence and operation cannot be performed

I have few scenarios where I am not able to perform any action on few dialog. When object added to watch, it gives object details but when some action is performed during run time it throws error message “Object is invisible hence and operation cannot be performed”.  Did anyone faced similar kind of issue.

5 Replies

  • All the time.

     

    It's a common automated testing problem.

     

    I have validation routines that check for existence and visibility of pretty much any object a script is about to use. If it doesn't come back as TRUE (exists & visible on screen), then I can't use the object and log some sort of error message instead.

     

    I use the same routine to check the opposite condition as well. ie. to make sure an object that's expected to vanish has actually vanished.

     

    The routine takes in:

     

    • An object locator reference.
    • Whether the object should be present or not.
    • How long to wait for that condition to be achieved.

    It's one of the most heavily used routines in my scripts. Without it, things would fail, crash, and get in a total mess all over the place. And one of the top priorities for ANY automated test for me is that it is almost impossible to crash it. If I'm running 8 hours worth of automated tests, I don't want to be having to check if it's crashed every 20 minutes.

     

    Robustness. Robustness. Robustness.

     

    It's so important I said it three times. :smileyhappy:

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Preach, Colin_McCrae

       

      SumanthKotha get VERY familiar with built in methods like "WaitChild" or "WaitAliasChild" or "WaitProcess" as well. These are VITAL to that robustness that Colin mentions when it comes to testing existence of an object. Just checking "Exists" on an object will generate warnings and errors if the object does not exist... using "WaitChild('ObjectName').Exists" takes care of that.

       

      Learn them. Use them. Love them.

      • SumanthKotha's avatar
        SumanthKotha
        Occasional Contributor

        Colin_McCrae and tristaanogre Thanks for info. Actually in my scenario, the application is developed in Java and a window is there where it was recognized for the first time and i did all my operations which i want to do, later i have button call "Next" which takes the same window to loaded with different objects, here also i was able to do all the operations which i want to do, now in this window i have "Back" button, once i click, it load the previous objects into the window now this time the same objects which was recognized earlier now its saying not able to recognize. i tried to declare the page objects again (thinking the old variables values might have become null when i move NEXT and BACK).

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm with Colin in this... the navigation "Back" may not, under the covers, take you to the same form... or, at least, some of the properties of the page, etc, may have gotten altered. Do an inspection at the failure point and compare it to what is actually mapped.