帮助QTP识别控件

发布于 2024-07-09 04:47:59 字数 686 浏览 6 评论 0原文

我们正在尝试使用 QTP (QuickTest Professional) 自动测试旧版 C++ 应用程序。

但是,应用程序的主窗口由多个相同的面板组成。 每个面板都有一个独特的标题。

如果我在 Spy++(DevStudio 附带)中查看窗口,我会看到:

+ Window <hwnd> "Window Title" taskwindowclass
  + Window <hwnd> "Panel A" childwindowclass
    + Window <hwnd> "OK" Button
  + Window <hwnd> "Panel B" childwindowclass
    + Window <hwnd> "OK" Button

然而,在 QTP 的 Object Spy 中,层次结构显示为:

+ Window: Window Title
  + WinButton: OK

它甚至没有显示有中间面板。

有谁知道如何获取窗口“路径”以识别每个控件? 即控件标识为:

Button A: "Window Title/Panel A/OK"
Button B: "Window Title/Panel B/OK"

We're trying to use QTP (QuickTest Professional) to auto-test a legacy C++ application.

However, the main window for the app is composed of several IDENTICAL panels. Each panel has a unique title.

If I view the window in Spy++ (comes with DevStudio), I see:

+ Window <hwnd> "Window Title" taskwindowclass
  + Window <hwnd> "Panel A" childwindowclass
    + Window <hwnd> "OK" Button
  + Window <hwnd> "Panel B" childwindowclass
    + Window <hwnd> "OK" Button

In QTP's Object Spy however, the hierarchy shows as:

+ Window: Window Title
  + WinButton: OK

It doesn't even show that there is an intermediate panel.

Does anybody know a way to get the window "path" in order to identify each control?
i.e. so the controls identify as:

Button A: "Window Title/Panel A/OK"
Button B: "Window Title/Panel B/OK"

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

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

发布评论

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

评论(1

初见你 2024-07-16 04:48:00

您可以使用描述性编程来绕过对象映射。 QTP 默认会忽略面板对象。 您可以尝试动态获取对面板对象的引用,然后搜索 ChildObjects 集合以找到“确定”按钮。 另一种选择可能是简单地向“确定”按钮添加序号标识符。

  • 按钮 A:“窗口标题/确定索引 #1”
  • 按钮 B:“窗口标题/确定索引 #2”

You could use descriptive programming to bypass the object map. QTP will ignore panel objects by default. You could try to get a reference to the panel object dynamically, then search the ChildObjects collection to find the ok button. Another option might be to simply add an ordinal identifier to the ok buttons.

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