This is a migrated thread and some comments may be shown as answers.

ScrollToVisible catch 22

3 Answers 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 05 Dec 2014, 10:54 PM
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

3 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 10 Dec 2014, 06:32 PM
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!
0
Doug
Top achievements
Rank 1
answered on 11 Dec 2014, 03:47 PM
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
0
Cody
Telerik team
answered on 11 Dec 2014, 05:38 PM
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!
Tags
General Discussions
Asked by
Doug
Top achievements
Rank 1
Answers by
Cody
Telerik team
Doug
Top achievements
Rank 1
Share this question
or