This project is read-only.

How to find a Dockbar and a menubar in it

Sep 2, 2010 at 9:51 AM


I'm trying to develop a UI test tool based on white. and there's a dockbar with three menubar in the main window. I find there's not a supported type for dockbar in white.and I have found a way to get it :

UIItem dockbar = (UIItem) mainWin.Get(SearchCriteria.ByControlType(ControlType.Pane).andIndex(0));

then I don't know how to get a menubar from it. maybe I can cast the dockbar to another type.


Sep 2, 2010 at 11:55 AM


can UISpy or UIAVerify see the Menubars?


Contoltype pane is a container, try




if this dont work




AutomationElement element = dockbar.GetElement(SearchCriteria.......)

MenuBar bar = new MenuBar(element, dockbar.ActionListener);






Sep 3, 2010 at 4:08 AM
Edited Sep 3, 2010 at 4:43 AM


thanks for your help, from the UI Spy I can see that the control type is pane ,but it doesn't contain anything, and in the UI we can see the popup menu named "File","View","Help" in the pane. just like the top line in the office word 2003. and I have try to get the menu via the code you just told me, but it doesn't work. 

I just check the vs2010 in the UISpy, it can show the menubar with menuitem like "File","Edit"... but  my project just shows some panes without anything contained. I don't know how does the UI organized.just like all the menubars has been hidden in the pane I don't know why.


Sep 3, 2010 at 6:47 AM



in that case you can only try to click to items by position, that is not nice but the only way.


If you have access to the developer of the application, than they should implement Automation Peer for the elements so they becomes visible for UIAutomation.



Sep 3, 2010 at 8:44 AM


thanks for your help, I guess the developer has defined some custom controls so that the UIAutomation cannot view it.

Sep 3, 2010 at 9:44 AM
Edited Sep 3, 2010 at 9:45 AM

Yes and he has not defined Automation Peer for them :)