UISpy 和 UIA 验证在同一程序上显示不同的属性值

发布于 2024-12-11 01:15:46 字数 314 浏览 1 评论 0原文

我正在测试一个程序,它的关闭按钮在某一点启用,在另一点禁用。 UISpy 在两个点上都显示“isEnabled”为“true” UIAVerify 在第一个点显示“isEnabled”为“true”,在第二个点显示为“false”,

后者是我可以直观地确认为真的,以编程方式我得到与 UISpy 相同的值,我的测试用例是失败。

使用系统.Windows.自动化;

树结构: “对话框”“程序名称” “标题栏”“程序名称” “按钮”“关闭”

有人知道是什么原因造成的吗? UIA verify 使用与 UISpy 不同的库吗?

I have a program I'm testing that has its close button enabled at one point and disabled at another.
UISpy shows 'isEnabled' at both points to be 'true'
UIAVerify shows 'isEnabled' at the first point to be 'true' and at the second to be 'false'

The latter is what I can visually confirm to be true, programmatically I'm getting the same values as UISpy and my test case is failing.

using System.Windows.Automation;

Tree Structure:
"Dialog" "ProgramName"
"title bar" "ProgramName"
"button" "Close"

Is anyone aware of what could be causing this? Does UIA Verify use a different library than UISpy?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木森分化 2024-12-18 01:15:46

UIA 验证 2.0 使用较新的本机 COM UIA 库,该库在 UIA 3.0 更新中与 Windows 7 一起发布(也可作为 Vista 和 XP SP3 的单独修补程序 KB971513)。另一方面,我认为 UISpy 使用原始的托管 API。

我使用 .isEnabled().invoke() 方法在托管库方面遇到了间歇性问题,我可以通过迁移到 COM 库来纠正这些问题,这似乎总体上比托管库更稳定、更快。

我不记得迁移过程的细节,但基本上您需要生成一个互操作 DLL,以允许您的 .NET 应用程序调用本机 UIA 方法。然后,您可以选择创建自己的包装器库,或者可能使用下面提到的其中之一。

我建议参考这些内容以获取转换过程中的帮助:

UIA Verify 2.0 uses the newer native COM UIA library that was released in the UIA 3.0 update alongside Windows 7 (also available as a separate hotfix KB971513 for Vista and XP SP3). UISpy on the other hand I think uses the original managed API.

I had intermittent issues with the managed library with the .isEnabled() and .invoke() methods that I was able to correct by migrating over to the COM library, which seems to be more stable and faster overall than the managed library.

I can't recall the specifics of the process of migrating over, but basically you'll need to produce an interop DLL that will allow your .NET application to call the native UIA methods. Then you can optionally create your own wrapper library or possibly use one of those mentioned below.

I'd recommend referring to these for help in making the transition:

  • UI Automation COM-to-.NET Adapter - An early attempt at creating a wrapper for the COM API. I had trouble just straight up using this, but it was helpful to take a look at initially. Also search for some of the MSDN support forum posts about the COM API made by this wrapper's developer. I unfortunately can't link to them because of my low StackOverflow rep (long time lurker, first time answerer).

  • UIA Verify Source Code - You can see that they have in their source code a UIAComWrapper which is used to access the COM interface. You can also take a look in that project at how they're producing the interop DLL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文