Forum Discussion

hhagay's avatar
hhagay
Contributor
8 years ago

there was an attempt to perform an action at a point which is beyond the screen

Hello All

I was wondering how many have experienced this error message with regards to the fact the TestComplete does not know how to recognize an object that exists on a web page, however not visible on the screen (meaning that you have to scroll to view it).

How did you resolve it?

 

Shouldn't this be at the core of what an automation tool is?

 

Here is what I found on Smarbear support site:

https://support.smartbear.com/testcomplete/docs/testing-with/running/handling-errors/out-of-bounds.html

 

Needless to say that the "Possible Causes of Problem" sections is missing the simple fact that testcomplete can't scroll and identify an object.

 

The answer I received from tech-support is to use the method scrollIntoView(). This is not smartbear method.

https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

 

I implemented the method but as it stands, during PLAYBACK, TC will behave inconsistently, scrolling at times, while other times it will fail

 

 

I look forward to a community member to help me solve one of the challenges I am having using TestComplete.

 

 

Thank you

 

function test(url, str)
{
  var btn_PropArray, btn_ValuesArray, page, btn;
  var box_PropArray, box_ValueArray, box;

  // Creates arrays of property names and values
  btn_PropArray = new Array("ObjectType", "contentText");
  btn_ValuesArray = new Array("Button", "Send To Employee");

  // Searches for the button
  page = Sys.Browser("chrome").Page(url);
  btn = page.FindChild(btn_PropArray, btn_ValuesArray, 2000);

  if (btn.Exists)
  {
    Log.Message(btn.FullName);
    btn.scrollIntoView();
    btn.Click();
  }
  else
    Log.Error("The object was not found.");
    
    
  // Creates arrays of property names and values
  box_PropArray = new Array("ObjectType", "textContent");
  box_ValuesArray = new Array("Label", str);

  // Searches for the check box
  box = page.FindChild(box_PropArray, box_ValuesArray, 2000);

  if (box.Exists)
  {
    Log.Message(box.FullName);
    box.scrollIntoView();
    box.Click();
  }
  else
    Log.Error("The object was not found.");
}

 

19 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I just recorded the following using TC12, the latest version of Chrome, and the TestComplete forum page.

     

    function Test1()
    {
        var browser;
        var page;
        Browsers.Item(btChrome).Navigate("https://community.smartbear.com/t5/TestComplete/ct-p/TestComplete_forum");
        browser = Aliases.browser;
        page = browser.pageCommunitySmartbearComT5Testc;
        page.panel.footer.link.Click();
        browser.pageSmartbearComProductTestexecu.Wait();
    }

    With this recording, when I playback, everything works fine... I don't even need to do a "ScrollIntoView"...TC automatically handles that.
     
    So... what's different between what you're doing and what I'm doing?

     

    I even made the following change, 

     

    function Test1()
    {
        var browser;
        var page;
        var link;
        Browsers.Item(btChrome).Navigate("https://community.smartbear.com/t5/TestComplete/ct-p/TestComplete_forum");
        browser = Aliases.browser;
        page = browser.pageCommunitySmartbearComT5Testc;
        link = page.FindChild(['ObjectType', 'href'], ['Link', 'https://smartbear.com/product/testexecute/overview/'], 2000);
        link.Click();
        browser.pageSmartbearComProductTestexecu.Wait();
    }

    Where, instead of just clicking, I find the object I want and then click it.

    So... something still is different.

    What type of object is it? What type of control? I see it saying "Button" as an object type but what sort of behind the scenes language and structure is being implemented to build those buttons? It could be that something is implemented differently in your application under test than what I'm experiencing.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Here's an interesting thought... I took a quick browser through the "related topics" on the right side of the screen here for your post (lots of folks have run into similar situations). In some of the cases, the scroll didn't happen if the object itself was not actually visible yet... or the object was not enabled... or things like that.

      So, you're telling TestComplete to go click on your button. Obviously, you've found the button... but is it enabled? Is it actually ready to be clicked at the moment that TC attempts to click it?  Could it be that it's waiting for some other process or script on the page to complete before you can click on the button?

      Just some things that my cold-medicine addled brain is processing today...

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        One other follow up:

        One of those other threads presented an interesting problem with a dialog... that each time the dialog was created on the page, it was kept on the page but disabled... so, every time through the test, there would be a new, disabled copy of the dialog on the page.  TestComplete couldn't interact with it because it wasn't on screen or visible... and yet, the human eye inspection said, "But I am looking right at it..."

        So... investigate, also, how the buttons are instantiated... it COULD be that you may be finding the button but finding the wrong COPY of the button and, therefore, cannot always click on it.