ScrollToVisible catch 22

4 posts, 0 answers
  1. Doug
    Doug avatar
    4 posts
    Member since:
    Jul 2013

    Posted 05 Dec 2014 Link to this post

    Here is my situation.... I have an element on the page I'm testing that is not visible on the screen (you have to scroll down to find it). My test throws an error that the element is not found. So I try using a coded step that has a line like this:

    Pages.Page.Element.ScrollToVisible();

    But, since ScrollToVisible is using the same object that couldn't be found to begin with, I end up with the same element not found error. Am I using ScrollToVisible correctly? The 'documentation' I've been able to find simply shows that ScrollToVisible exists. Nothing with an example or the context in which it is used. Any help on how to address this situation would be appreciated.

    Thanks

    Doug
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 10 Dec 2014 Link to this post

    Hello Doug,

    What type of application are you testing? HTML? Silverlight? WPF? I ask because there's subtle but important difference when dealing with elements not scrolled into view.

    For HTML applications, many of our customers misunderstand what Verify Is Visible actually does. It isn't verifying you can current see it in the browser window. It is instead verifying the element is set for display in the DOM i.e. it doesn't have a DISPLAY:NONE attribute set. So an element may not be visible to the human eye but IsVisible will still return true when:
    • The element is being painted but is scrolled out of view
    • Another element overlays the element being tested

    Now back to your problem. The error "element is not found" actually means that Test Studio is unable to locate the element at all in the applications DOM. Since it cannot find it, it can't even test the visibility property of the element. It's akin to asking "is the color of this car red?" when there's no car to look at.

    So we need to figure out why Test Studio cannot find the target element in the first place. Please go to Step Failure Details, find and click Export then attach the generated .zip file. It contains valuable information we need to diagnose this type of failure.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Doug
    Doug avatar
    4 posts
    Member since:
    Jul 2013

    Posted 11 Dec 2014 in reply to Cody Link to this post

    Hey Cody
    Thanks for the reply. In discussing this with one of our developers, I understand that for performance purposes the app fetches the data to display on one page. Then, when the user scrolls, more data is fetched and displayed. The object I'm looking for is slightly beyond the first page of data and does not exist until there is a scroll or page-down event. Mystery solved. Sorry for not checking with them first.

    Thanks

    Doug
  4. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 11 Dec 2014 Link to this post

    Hello,

    Thank you for the update! I'm glad to hear you were able to figure out the root cause of the problem. Hopefully I was able to clear up some misconceptions along the way.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top