This project is read-only.

Get from UIItem

Dec 16, 2011 at 3:32 PM

Is it possible to use Get method from a UIItem?

I can use get from the Window, but doesn't work (null ref exception) from UIItem:


var supply = (UIItem)window.Get(SearchCriteria.ByAutomationId("supply") //Works
var childFromWindow = (UIItem)window.Get(SearchCriteria.ByAutomationId("childOfSupply") //Works
var childFromSuppy = (UIItem)supply.Get(SearchCriteria.ByAutomationId("childOfSupply") //throws

Dec 18, 2011 at 11:33 AM

Your element should implement IUIItemContainer interface in order to use Get method.

Like Window, Desktop, GroupBox, Panel, ContainerStrip

Through white you can't search for descendants of some item that not implementing IUIItemContainer, but you can achieve it through regular Windows Automation classes.  

Dec 19, 2011 at 8:33 AM


is this a WPF or a WinForm application?

in WPF use

using White.Core.UIItems.WPFUIItems;

and Get will be available on each UIItem.