If anyone reads this question you may want to know that it looks like the System.Windows.Automation is apparently deprecated!!!!
I am going to attempt to use the IUIAutomationElement COM interface instead!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Using UIAutomation, certain elements are not available through TreeWalker even though I can see them with Accessibility Insights.
As you can see in the image, the tab element has 3 child elements, pane and 2 tab items.
When I try to get the first child (e is the tab element).....
Dim ee As AutomationElement = TreeWalker.ControlViewWalker.GetFirstChild(e)
.....it returns the first tab item. I then try to get the next sibling......
ee = TreeWalker.ControlViewWalker.GetNextSibling(ee)
....and it returns the second tab item. If I then try to get the next sibling it comes back with nothing as expected.
So, for some reason it isn't returning me the pane element.
Any ideas please?
Thanks
Tony
If anyone reads this question you may want to know that it looks like the System.Windows.Automation is apparently deprecated!!!!
I am going to attempt to use the IUIAutomationElement COM interface instead!
I've also tried the following to try and find the pane element but still no luck (mainUIA is the window element)....
Dim e As AutomationElement = Nothing
Dim es As AutomationElementCollection = mainUIA.FindAll(TreeScope.Descendants, New PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "pane"))
If es.Count > 0 Then
For x As Integer = 0 To es.Count - 1
e = es.Item(x)
If RTrim(e.Current.Name) = "Result" Then
Exit For
End If
Next
End If
BOOOOOOOOM!
I'm now getting all the elements I'm expecting.
Hopefully someone else having the same issues finds this thread!