Approach 1:
AutomationElement item1 = TreeWalker.ContentViewWalker.GetFirstChild(item);
item1 = TreeWalker.ContentViewWalker.GetFirstChild(item1);
item1 = TreeWalker.ContentViewWalker.GetNextSibling(item1);
AutomationElement autoElement1 = FindChildElement("textBoxPath", item);
Note:
// Summary:
// Represents a predefined System.Windows.Automation.TreeWalker containing a
// view of elements in the tree that are marked as content controls.
ContentViewWalker;
//
// Summary:
// Represents a predefined System.Windows.Automation.TreeWalker containing a
// view of elements in the tree that are marked as controls.
ControlViewWalker;
//
// Summary:
// Represents a predefined System.Windows.Automation.TreeWalker containing a
// view of all the elements in the tree.
RawViewWalker;
Approach 2:
Condition propCondition = new PropertyCondition( AutomationElement.AutomationIdProperty, controlIDorName, PropertyConditionFlags.IgnoreCase);
// Find the element.
rootElement.FindFirst(TreeScope.Descendants, propCondition);