uiautomation未能找到子节点
试图自动化IIS(INETMGR)尝试使用UIAUTomation,我正在解决混合的结果。如果屏幕元素很好,我能够得到一些,其他,甚至是直接的孩子节点,都无法找到[first | all]或在树walk虫(内容| Control | Raw)中尝试,只是可以' t获取所需的节点。有什么建议用于驱动UI自动化它的方法?
窗口10/11桌面环境。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个C#控制台应用程序,可从“连接”窗格中转载Inetmgr项目的(最大2级)。
此必须以管理员的身份启动,否则它将失败(不立即)。一般而言,UIA客户端必须在UAC级别上运行与自动化应用程序相同的UAC级别。
要确定从树中获得什么或是否可以完成任何操作,在任何编码之前,我们可以使用从Windows SDK 或最新的
另外,我使用Windows的uiautomationclient com对象,而不是Windows XP时代的旧版本,因为它错过了很多东西。
代码迭代所有递归使用因为Inetmgr的树具有懒惰的加载行为,因为它可能包含数十万个项目(在某些点映射到磁盘文件夹)。
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).