Trying to automate IIS (INetMgr) trying to use UIAutomation, i'm fixing mixed results. I'm able to get some if the screen elements good fine, others, even immediate children nodes, can't get either with a Find[First|All] or try in a treewalker (content|control|raw), just can't get the node(s) needed. Any suggestion what to use for driving the UI to automate it?
Window 10/11 desktop environment.
Here is a C# Console app that dumps (max 2 levels) of InetMgr's items from the "Connections" pane.
This must be started as Administrator otherwise it will fail (not immediately). In general UIA clients must run at same UAC level as automated apps.
To determine what to get from the tree or if something can be done, before any coding, we can use the Inspect tool from Windows SDK or the more recent Accessibility Insights.
Also, I use Windows' UIAutomationClient COM object, not the old one from Windows XP era as it misses lots of stuff.
The code iterates all tree items recursively and expand them if they are not expanded using the ExpandCollapse Control Pattern because InetMgr's tree has a lazy loading behavior as it can potentially contains hundreds of thousands of items (mapped to disk folders at some points).