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

ScrollToVisible with horizontal scroll bars

10 Answers 739 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shashi
Top achievements
Rank 1
Shashi asked on 26 Jun 2013, 09:18 PM
Hello,

Is the Scroll To Visible command supposed to work with horizontal scroll bars (scrolling from left to right and vice-versa)?  If so, what option should we use? (neither seems to be appropriate for horizontal scroll bars).

If Scroll to Visible does not support horizontal scroll bars, are there any other commands available for horizontal scrolling?
NOTE:  Recording a scroll action produces a drag command on BackgroundGradientRectangle object - problem with this is that it is very sensitive to screen resolution, browser window size, etc.

The above is both with our current version (TS 2012.1.411.0) and the version we are evaluating (for possible upgrade) - 2012.2.1420.0.  AUT is a Silverlight web application.

Any help would be much appreciated.

Thanks,
Shashi

10 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 01 Jul 2013, 07:10 PM
Hi Shashi,

Our Scroll To Visible option was only designed to work with the browsers outermost vertical scroll bar. It cannot handle a horizontal scroll bar or cases where a scroll bar is added to a <div> element.

Recording a Drag & Drop may be the best option for you. Our Drag & Drop test step will deliberately resize and re-position the browsers window to where it was at during screen recording. This insulates you from different browser sizes, resolution and positions when the test starts.

Another approach, if you can handle some code, there is a way to locate an element and scroll it both horizontally and vertically. Here's a code sample that demonstrates how to vertically scroll for a RadGridView. If you study the code you should be able to figure out how it works. I'll need to do some research to find the equivalent for horizontal scrolling, but it shouldn't be too difficult.

Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Cody
Telerik team
answered on 01 Jul 2013, 07:22 PM
Hi Shashi,

I forgot to include the link to the code sample article:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/silverlight/radgridview/scrolling.aspx


Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Shashi
Top achievements
Rank 1
answered on 05 Jul 2013, 06:19 PM
Hi Cody,

Our app is Silverlight-based and uses Telerik's Silverlight controls.  In addition to the browser scroll bar, many of our controls also can have scroll bars.  In all cases, the app displays the scroll bar only if needed. 

I have tried ScrollToVisible and it works well with all vertical scroll bars in the above scenario. It is much more reliable than Drag and Drop for the following reasons:

a) I can control the amount of scrolling based on the element I want to see rather than a screen pixel location - which may or may not make the element that I am targeting visible depending on screen resolution, browser location, browser window size, etc. 
b) It also does not change browser window size or position as the Drag and Drop steps do.  Latter is disconcerting at best (if you are watching the test run) and also cause tests to fail with browser out of bounds errors in some circumstances.
c) It also handles the case where the scroll bar is not present.  This is particularly advantageous in scenarios where the app shows the scroll bar only if it is needed (as is the case with our app).  With the Drag and Drop method, we have to enclose the Drag and Drop in an IF/ELSE to check existence of the scroll bar child element (usually a BackgroundGradientElement) before drag/dropping it.
d) It does not give rise to weird (unintuitive) mouse movements when test is playing back which were not how we recorded it.  I have seen this happen often with Drag and Drop scrolling.

However, there are a couple of issues (this is for 2012.1.411.0 - and I believe 2012.2.1420.0):
a) ScrollToVisible only works as a coded step
b) It does not work with horizontal scroll bars.

I think enhancing ScrollToVisible to support all application scroll bars - vertical and horizontal - (rather than just browser page scroll bars) - would be a great addition to Test Studio.  It would be good if you can also fix the first issue. 

Let me know your thoughts ...

Shashi
0
Cody
Telerik team
answered on 08 Jul 2013, 09:34 PM
Hi Shashi,

I have tried ScrollToVisible and it works well with all vertical scroll bars...

Excellent discovery! Also I didn't realize this was for a Silverlight application (until now).

ScrollToVisible only works as a coded step 

I don't think so. It's available on our Element Menu. See Scroll Element on this page.

It does not work with horizontal scroll bars

This is true. I've created a feature request here. For now you can use code like this to scroll horizontally:

VirtualizingPanel.InvokeMethod("SetHorizontalOffset", horizontalOffset);

Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Shashi
Top achievements
Rank 1
answered on 08 Jul 2013, 10:07 PM
Hi Cody,

Thanks for your response.  Responses to some of your comments ...

Also I didn't realize this was for a Silverlight application (until now).
I thought you would remember that from our many interactions over the past couple of years :) (just kidding! ).  Sorry about that - I should have mentioned it in my original post.

I don't think so. It's available on our Element Menu. See Scroll Element on this page.

Yes - I know it is available on the Element menu - but the recorded step version does not work (at least for us).  The step is executed and apparently passes - but the scroll bar does not move.  It does move if I convert the recorded step to a coded step.

Thanks for filing the feature request for horizontal scroll bars (I have 'liked' it). 

For now you can use code like this to scroll horizontally:
VirtualizingPanel.InvokeMethod("SetHorizontalOffset", horizontalOffset);

Is the horizontal offset a number indicating the amount by which the scroll bar should move?  If so, wouldn't this have some of the same issues as Drag and Drop - sensitivity to browser size, screen resolution, etc?

Shashi
0
Cody
Telerik team
answered on 10 Jul 2013, 01:43 AM
Hi Shashi,

Yea I probably should have remembered you're working with a Silverlight application as well. Sometimes it's hard for me to keep them all straight because I deal with about 50 different customer issues/day.

The step is executed and apparently passes - but the scroll bar does not move.  It does move if I convert the recorded step to a coded step.

Oh I see. That sounds like a bug to me. I'll work on a repro then file a bug for our developers to investigate what's going on.

Is the horizontal offset a number indicating the amount by which the scroll bar should move?

Not exactly, it's the number of pixels to move the horizontal viewport to. It's an absolute setting, not a relative setting. Let's say the UI element being scrolled is 900 pixels wide but you can only see 100 pixels at a time in the view port (the window with the scroll bars). If you set this value to 100, the first 100 pixels will be scrolled off to the left such that you can't see them. You can see pixels 100-200 and the remaining pixels will be off to the right of the view. Similarly if you set the value to 350, 350 pixels will be scrolled off to the left, you can see 350-450, and 450-900 will be off to the right.

This makes you immune to screen resolution, browser size, browser position and so on.

Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Chery
Top achievements
Rank 1
answered on 15 Nov 2013, 08:54 AM
Hi,
Do you have solution for horizontal scrolling, I am trying to find a way to do horizontal scrolling to a rad grid column not visible in the screen.
My application is a WPF application using rad grid control.
Regards
Chery Jose
0
Boyan Boev
Telerik team
answered on 18 Nov 2013, 01:19 PM
Hello Chery,

Unfortunately the feature request for horizontal scrolling is still in the development stage.

For now you can use the coded workaround:

VirtualizingPanel.InvokeMethod("SetHorizontalOffset", horizontalOffset);

Thank you for your understanding.

Regards,
Boyan Boev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Chery
Top achievements
Rank 1
answered on 27 Nov 2013, 05:38 AM
Hi Boyan,
Thanks for your response it kind of works for me. Also thanks for giving me solutions to support questions, I am able to move faster with TS automation now.
 I think it will be good to have a feature in Test Studio to do relative scrolling, like for instance horizontal scroll to a specific column in RadGridView. I think it will be very useful than blind absolute scrolling using pixels. In the application which I am trying to automate with Test Studio, there are grids inside rows of a Main grid (Grids within Grids) and to see that child grid cell values, scrolling can be done only from the main Grid. Its so painful and meaning less to do scrolling with pixel number than able to do a relative scrolling to some UI element in the screen.
Regards
Chery Jose
0
Ivaylo
Telerik team
answered on 29 Nov 2013, 03:01 PM
Hello Chery,

Your feature request about the relative scrolling has been added. You can review and vote for it using this public URL.

Regards,
Ivaylo
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Shashi
Top achievements
Rank 1
Answers by
Cody
Telerik team
Shashi
Top achievements
Rank 1
Chery
Top achievements
Rank 1
Boyan Boev
Telerik team
Ivaylo
Telerik team
Share this question
or