Forum Discussion

rgareme's avatar
rgareme
Occasional Contributor
11 years ago

Catch "There was an attempt to perform an action at a point, which is beyond the screen" error

I am testing a web page and I have to click on a dialog (panel) to confirm an action. In the Jscript script, I wait until the dialog is visible (I use the waitProperty method). The first time that the dialog appears, the action is done correctly. The second time, although the panel is not visible, the waitProperty method returns true. So, when i try to click in a button of the panel I get the error "There was an attempt to perform an action at a point, which is beyond the screen". Maybe this behavior is an error of the web but I surround the click operation with a try/catch sentence and i cannot caught the exception to continue with the test.
  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    I was hoping you would have better luck with the VisibleOnScreen but seems you are running into this same issue here. It's more effort, but you can first check it's Exists property then it's top, left, and height etc. in conjunction with the .SetFocus() method.

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Try again, my fingers are very fat today :).
  • rgareme's avatar
    rgareme
    Occasional Contributor
    If I use VisibleOnScreen with the WaitProperty() function, the function always returns false (timeout). If I check the VisibleOnScreen property of the object, I get true when the object is visible and false when not. 
  • rgareme's avatar
    rgareme
    Occasional Contributor
    Thanks for the answer. I cannot open the first link, I get an error when I click on it.
  • rgareme's avatar
    rgareme
    Occasional Contributor
    Thanks for your help. I will try the solution that you say. For the moment, I have found a workaround. One of the child objects of the dialog (panel), changes the value of its VisibleOnScreen property correctly and I can use it to do what I need. 
  • If you're sure that the object is there you can use .ScrollIntoView() to force your browser to scroll to the part of the page where element is.
  • dfarr's avatar
    dfarr
    Occasional Contributor
    Ruben,

      Although you have solved your problem, I can't help think that your problem was similar to one I struggled with. If so, you might find this helpful or interesting.

      Our browser application is developed in AngularJS. I use FindChild and a keyword-to-property/value mapping for object acquisition in my scripts. (Not TestComplete’s Name Mapping and Aliasing).

       In our AUT, a button click would open a dialog (“Panel”/Div/modal class) whose existence and visibility I wanted the automated script to validate.

       When the dialog was open, Object Spy reported its visible and visible-on-screen properties as true. But when the script ran and opened the dialog, it reported the dialog as not visible and returned a failure. When running the script in debug mode, inspection of the dialog object after it was acquired showed its visible properties to be false, even though object spy reported these as true. It was not a timing/synchronization issue.

        Why did findchild at runtime report the dialog as not visible while Object Spy reported as visible?

         I cracked open the html with firebug in Firefox and saw this: There were 4 instances of the dialog, and 3 of them were grayed-out. That is, every time the dialog was opened and closed, the html code for the object remained, but only one of them was “active”. Object Spy saw the active instance, but findchild happened to find one of the 3 “inactive” instances. So, a little more exploration allowed me to find an attribute that could distinguish the “active” instance from the others and the simple addition of a property and value to the mapping allowed findchild to acquire the active instance and the problem was solved.

        I wonder if you were facing the same condition and hope this long response was at least interesting. :-)

     

    @ Andrey: Thanks for that suggestion; that may be handy sometime.
  • chrisb's avatar
    chrisb
    Regular Contributor
    Try scrollIntoView method, fixed the same problem for me.