This project is read-only.

How to use the scroll in the Pane...

Apr 20, 2010 at 3:01 PM

Hello All,

          I wanted to know how do we use the scrollbar to move inside of an UI element. The element  I am working on now is recognized as Pane when spied through the UIA Verify.

1. Also, is there a way to control how much to scroll rather than just end or start?

2. I would also need information on how much more of the scroll is left over on each scroll.

Could anyone please help on the same. We are planning to retire QTP and move with an Open source tool and I found White promising. 

Apr 20, 2010 at 3:45 PM
Edited Apr 20, 2010 at 3:46 PM


if the white elements is a container

there is an element ScrollBars (with Horizontal and Vertical), on the container object as I know

these Elements are type of IHScrollBar and IVScrollBar

you can scroll or scrollLarge in allowed directions


which White Type do you use?

If you don't know try to use UIItem and try to get the correct Type from the element.




Apr 20, 2010 at 7:31 PM

Thanks for the reply Throndorin. I was able scroll and also was able to get the Max pos, Min pos and the current Pos. Its Fantastic!

By the way, when i spy the UI element which I need to work on, I don't get a AutomationID or even Name property. Some of the properties for which I get some value are as below: 

    Properties Seen :  ClassName : SWT_Window0, ControlType : ControlType.Pane, FrameWorkID : Win32, Localized ControlType : Pane

The problem I face in this application is that finding the index is too had. There are just too many panes and its quite difficult to get the index of the required Pane. For the same problem, is there a way I can identify by passing the hwnd of the pane and recognize the element through White? I can get this handle as well in AutoIT and also with the AutoIT, the instance would be shown because of which the maintenance of the script is easy. FYI - I tried for around 40+ pane to identify the Index. 



Apr 21, 2010 at 10:32 AM

If you don't have access to the developer, there is no better way, I think. If you have access, the developer should add automaton ID's => this is the best way.

Are the panes on the same level in UISpy or is there a hierarchy?

if you have a hierarchy its easier. 

if you need more infos about a pane

have a look in pane.AutomationElement.Current => there are some more informations, there is a string with the native Window handle. If that helps you can use


AutomationElement element1 = parent.AutomationElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NativeWindowHandleProperty, "handle"));

than you can generate the needed  White element for better handling

UIItem item = new UIItem(element1, parent.ActionListener); better is teh correct type, because of type specific operations.







Apr 21, 2010 at 10:58 AM
Edited Apr 21, 2010 at 11:01 AM

Yes Throndorin. Some Panes are on the same level and inside of these, we have hierarchy. So, let me try the solution you have given. Will post back about what happened.

Thanks a ton Throndorin :)

Apr 21, 2010 at 1:50 PM

Hello Throndorin,

          I was using the following code :

            AutoItX3Lib.AutoItX3Class autoIT = new AutoItX3Lib.AutoItX3Class();
            String hwnd = autoIT.ControlGetHandle("InfraStruXure Designer", "", "[CLASS:SWT_Window0; INSTANCE:11]");
            AutomationElement element = mge.AutomationElement.FindFirst(TreeScope.Children,new PropertyCondition(AutomationElement.NativeWindowHandleProperty, hwnd));
            UIItem item = new UIItem(element, mge.ActionListener);

It is failing at the PropertyCondition.

Can I use it this way - AutomationElement element = AutomationElement.FromHandle(hwnd1);

where hwnd1 is converted to IntPtr.

Apr 21, 2010 at 2:47 PM


I never used the NativeHandleProperty, it was only a possible solution as far as I know which options you have.

I'm not sure why there is an exception, maybe the microsoft forum which handles UIAutomation can help here.


in your solution it seems that the application and the test runs in the same process => this is not supported.


Maybe it would be better to try something like this:

all elements you have problems with - nested or not-  are panes, right?

so your start point is a window?

Window window = application.GetWindows().Where(p=>p.Name =="a name").First();

AutomationElementCollection coll = window.AutomationElement.FindAll(TreeScope.Children, new PropertyCondition( AutomationElement.ControlTypeProperty, ControlType.Pane ));


TreeScope.Children => you get only the direct children of the window element.

Maybe next step


List<UIItem> items = new List<UIItem>();

foreach(AutomationElement element in coll)


  items.Add(new UIItem(element, window.AutomationElement));



on each UIItem you have, you can now do the same to get the nested pane's


maybe you can identify panes because of specific labels, buttons,  or something like that, so I would suggest to write a helper class which returns you the searched pain.


if you don't want to use UISpy all the time you can use LogStructure on each white element.


This will give you all nested elements.











Apr 21, 2010 at 4:04 PM

Thanks a lot Throndorin. I will try that... Still need to understand more on White though...



Apr 21, 2010 at 4:17 PM

Learning by doing :)


I use White  a few month.

first I have to learn that White is "only" a framework for UIAutomation


Than I look in this and the microsoft Forum. To search specific things.


But there is much more to learn :)





Apr 21, 2010 at 5:45 PM

:) As I had been working on QTP all this while, this is really new to me... :)

But there so much more we can do using open source tools is what I realise :)