繁体   English   中英

UI自动化和功能区控件

[英]UI Automation and Ribbon control

我使用UIAutomation API为WPF应用程序做自动化。 一切顺利,直到我点击Ribbon控件。 我可以通过Inspect.exe查看有关Ribbon及其子项的信息,但在代码中我无法获取有关这些元素的信息。

换句话说,在此代码中,aeElement始终为null:

aeElement = aeForm.FindFirst(TreeScope.Children,
                  new PropertyCondition(AutomationElement.NameProperty, "XXX"));

我尝试了TreeScope.DescendantsTreeScope.Elements 我尝试了AutomationElement.ControlTypePropertyAutomationElement.AutomationIdProperty 我尝试过TreeWalker - 没什么用。

想知道是否有针对该问题的解决方案? 非常感谢你提前。

编辑: http ://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=windowsaccessibilityandautomation也没有答案。

你最糟糕的情况是根,对吗? 然后尝试以下解决方案:

一种。 从根目录搜索,然后深入到窗口,上下文等等

如果一个不起作用,那一定是你的拼写。 名称区分大小写。

C。 你为什么不使用AutomationID? 它是为那个用途而创建的!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM