This project is read-only.

Get method is not working

Oct 16, 2009 at 2:56 PM

Hi all,

 I have a combo box in a window and the combo box has got couple of child elements.  I have used window.Get to get the WPFComboBox as below

 WPFComboBox combo = window.Get<WPFComboBox>(SearchCriteria.ByAutomationId("mycombo"));

Now on calling combo.Get<Image>(SearchCriteria.ByAutomationId("myimage"));  it throws null reference exception in the constructor of UIItem.

At the same time if I directly retrive the element from window it is working fine. On debuuging the code it looks like the filed automationElement is null in the object retured fromDynamicProxyGenerator.Instance.CreateProxy.

Is it OK to call combo.Get(… ) if not  please suggest the best option to retrive child elements



Oct 19, 2009 at 7:15 AM


I am not sure whether we can use combo.get.

Instead try getting the automation element of the image using the combo as parent and then convert it into a image

AutomationElement aeimage = combo.automationelement.FindFirst(Treescope.children, new PropertyCondition(AutomationElement.AutomationIdProperty,"myimage"));

Image img = new Image(aeimage, new NullActionListener());




Nov 1, 2009 at 7:23 AM
Edited Nov 1, 2009 at 7:23 AM

Please have a look at WPF Items section on page