Retrieve non-control child from automation element

271 views Asked by At

Using the inspect.exe tool, I can see that an automation element has 6 children, but one of them has both the isControlElement and isContentElement set to false. I then used windows automation in c#, to try and retriev the children of the automation element with the following lines:

 var cond = new PropertyCondition(AutomationElement.IsEnabledProperty, true);
 var children = addressParent.FindAll(TreeScope.Descendants, newCond);

But i get all but the 1st child, which is the one that's "not a control". The condition used is a general one, because the child i'm looking for has no name or AutomationID (or any specific identifier).

I also tried using different conditions based on the missing child characteristics like

LocalizedControlTypeProperty - "text" or IsControlElementProperty - false or even searching for all descendants instead of children, but none of those helped finding it.

A thing to mention is that in Inspect.exe the siblings are linked correctly, the missing control next sibling points to the next one of the 6, and the 2nd one's prev sibling points to the missing one. But, in code the 2nd one from inspect is first. The control that's missing has no children.

0

There are 0 answers