How to access scrollbar buttons in the silverlight apps

Class library usage, coding and language questions.
rekha1234
Posts: 6
Joined: Fri Jul 22, 2011 8:12 pm

How to access scrollbar buttons in the silverlight apps

Post by rekha1234 » Tue Aug 09, 2011 10:34 pm

Hi Team,
I need to automate a test case where i need to click on the child node of a tree and when ever i expand the tree items, both horizantal and vertical scroll bars get enabled and the child item that i need to click is hidden by the scroll bar. So , i need to automate my test case in such a way if the child item is not visible then move the horizantal/vertical scroll buttons to right /down and click on the child item. Unfortunately Ranorex Spy doesnot identify the Scroll bar buttons. Can some one please guide me through this? How am i supposed to control the scrollbar button actions. Please find teh attached screenshot and Snapshot of the TreeView
Attachments
TreeviewSnapshot.rxsnp
(442.79 KiB) Downloaded 168 times
Ranorex_ScrollBar.png
Ranorex_ScrollBar.png (59.89 KiB) Viewed 1753 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to access scrollbar buttons in the silverlight apps

Post by Support Team » Wed Aug 10, 2011 11:17 am

Hi,

Do you have tried to use the ensure visible function of the Link element?
If not please give it a try.
Otherwise there are more possibilities how you can solve this problem.
At first take a look at Spy if you can find the scrollbar element in another location/folder.
If you can't find it, it seems that there is a lack of the UIAutomation implementation for this element and you have to find a workaround.
A workaround can be if you set the focus on the Tree "RadTreeView" and then try to scroll with the keyboard or the mouse wheel.

Regards,
Markus
Ranorex Support Team
.
Image

rekha1234
Posts: 6
Joined: Fri Jul 22, 2011 8:12 pm

Re: How to access scrollbar buttons in the silverlight apps

Post by rekha1234 » Mon Aug 15, 2011 5:21 am

Hi Markus,

Thanks a lot for your reply. I have tried all the possible suggestedways
1. Used Ensure Visible() for the element
2. Used set focus on the treeview
3. Tried spying on the scroll in different location. But nothing worked :( Not really sure if this is a limitation on the ranorex tool or something else.

Below is the sample code that i tried
Ranorex.TabPage tabpage = "/dom[@domain='10.10.122.60']/body/form/div[@id='silverlightControlHost']/object/form/tabpagelist[5]/tabpage[@name='Filters']";
IList<Ranorex.ScrollBar> tpScroll = tabpage.FindChildren<Ranorex.ScrollBar>();
clearLink.EnsureVisible();
Delay.Seconds(1);
clearLink.Focus();
clearLink.Click();
Any suggestions to get the control of the scroll bar element is greatly appreciated!!
(Note: I have attached the snapshot of the tree view in the previous post)


Thanks alot in advance
Rekha

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to access scrollbar buttons in the silverlight apps

Post by Support Team » Tue Aug 16, 2011 4:38 pm

Hi,

In your snapshot I can't find any scrollbars, maybe they are on a higher level in your application. Did you check this by navigating through the element tree in Spy?
Your application under test (AUT) uses Rad Controls right? Ranorex uses UIAutomation to recognize elements in WPF applications. This could be a limitation of those Rad Controls not providing UIAutomation elements for the scrollbars.

If Ranorex can indeed not recognize the scrollbars and there is no way to change the UIAutomation implementation of the AUT, then you have to find a workaround using mouse or keyboard inputs. E.g. when a list item has focus, try if the keyboard keys move the scroll bar. Alternatively, you could use a mouse wheel action to scroll horizontally and vertically.

BTW, with Ranorex 3.1 EnsureVisible should work a little better with WPF controls implementing a ScrollProvider.

Regards,
Peter
Ranorex Team
.
Image