This project is read-only.

UI Automation for WPFTreeNode containing textbox

May 19, 2011 at 7:07 AM


I am trying to automate one application containing WPFTree. Each tree noce has 2 text boxes. 1 for the node name (which I get) and other to display count against it.

This 2nd text box I am unable to get. We can use UI Automation for this.

Can anybody tell me how? I tried following code :

var children = wpfNode.AutomationElement.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty,

May 19, 2011 at 8:11 AM


first take care that both textboxes are visible for UIAutomation, does UISpy or UIAVerify show both Textboxes?


if so you can also try

IUIItem[] items = wpfNode.GetMultiple(SearchCriteria.ByControlType(ControlType.Text);


does your code don't work using UIAutomation?

try TreeScope.Descendants instead TreeScope.Children



May 23, 2011 at 9:46 AM

I gave that text box with the count an auto ID andused GetElement on the node level to search for the desired textbox.

This worked....