Hello,
We are using below method to find sub tree items. Able to find Main node but it is showing zero children in it. By using inspect tool Main node is showing like group and sub tree also able to see. We used name property to get sub child elements but tried using element collection also. It is also returning only main nodes. It happened after we upgrade our framework to 4.5.2.
public static AutomationElement GetElementByNameFromDescendants(AutomationElement parentElement, string value)
{
return Utility.TryGetElement(() =>
{
return parentElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, value));
}, 10, 1000);
}
To get element collection:
public static AutomationElement GetElementByPartialNameFromDescendants(AutomationElement element, string value){
AutomationElementCollection elementCollection =
element.FindAll(TreeScope.Descendants, Condition.TrueCondition);
int count = elementCollection.Count;
for (int i = 0; i <= count - 1; i++)
{
if (elementCollection[i].Current.Name != null)
{
if (elementCollection[i].Current.Name.IndexOf(value) >= 0)
{
return elementCollection[i];
}
}
}
return null;
}