Forum Discussion

shankar_r's avatar
shankar_r
Community Hero
8 years ago
Solved

Is there any way to check the Click action.

I'm getting error message as "There was an attempt to perform an action at a point, which is beyond the screen." while performing click action on a particular object.

 

Can i get return value or something to know whether click operation was success or fail at the run time? I know i will get a error message as mentioned above.

  • Turn your test case into a method with a return value of true or false based upon success of the test case... if test case 2 returns true, no need to close the window... if test case 2 returns false, you need to close the window.

    This is actually a pretty good methodology for any test case in a test automation environment... it allows you, eventually, to organize your test cases into larger batches where you can make the batch run/execute test cases based upon previous statuses.  

    For that matter, it's also a good idea that each test case should be as "atomic" as possible so they can be run without dependency.  If Test Case 3 is fragile enough to break because a previous test case left the application in a bad state, that means that test case 2 didn't have sufficient "tear down" code... nor did test case 3 have sufficient "set up" code.

8 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The error message you got is your return value... the click failed.  It seems like the state of the system before you attempt the click is the more pertinent question... is the application in a state where the click will pass or fail?  In this case, the component or object is not in the right place on screen... I'd throw a check in on that before I do the click, especially if this is a common occurence.

    • shankar_r's avatar
      shankar_r
      Community Hero

      Do i get a return string or Object in below code?

      var tempCheck  = Aliases.******.ServerControlMenuBar.Click();

      Log.Message(tempCheck);

       

      What i want to do is, If the click operation fails then i should close the window hence if i get any return value then i will do my staffs based on that.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        No. Most of those UI interaction actions don't have any return value.

         

        As mentioned, your check should first be on ServerControlMenuBar to make sure it's in a state to allow the Click, not on the click action itself.

         

        I suppose you COULD wrap your click action in try/catch logic but I know there are some limitations... I'm not sure try/catch will capture those kinds of errors.