帮助QTP识别控件
我们正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用描述性编程来绕过对象映射。 QTP 默认会忽略面板对象。 您可以尝试动态获取对面板对象的引用,然后搜索 ChildObjects 集合以找到“确定”按钮。 另一种选择可能是简单地向“确定”按钮添加序号标识符。
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.