如何在QTP中获取文本区域检查点的x,y坐标?

发布于 2024-12-28 02:19:42 字数 111 浏览 3 评论 0原文

在 qtp 中录制时,使用文本区域检查点来选择某些区域。录制和回放后保存测试用例。现在我想知道所选区域的 x 和 y 坐标。是否可以在 result.xml 或保存的测试用例中的某个位置查看 x 和 y 值?

While recording in qtp using a text area check point to select some area. After recording and playback save the test cases. Now I want to know the x and y coordinates for the selected area. Is it possible to see the x and y values in result.xml or somewhere in saved test case?

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

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

发布评论

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

评论(1

野味少女 2025-01-04 02:19:42

我不太明白你想要什么。也许你可以解释得更详细。暂时,我给你一些信息,你可以使用:

如果你想要一个对象的绝对坐标,使用:

absX = myObj.GetRoProperty("abs_x")
absY = myObj.GetRoProperty("abs_y")

对于一个对象相对于其父对象的坐标,使用:

relX = myObj.GetRoProperty("x")
relY = myObj.GetRoProperty("y")

获取文本检查点的相对坐标区域,使用:

cpRelX1 = CheckPoint("text area checkpoint").GetProperty("text_area_x1")
cpRelX2 = CheckPoint("text area checkpoint").GetProperty("text_area_x2")
cpRelY1 = CheckPoint("text area checkpoint").GetProperty("text_area_y1")
cpRelY2 = CheckPoint("text area checkpoint").GetProperty("text_area_y2")

如果想得到播放时检查点的绝对位置,则需要将文本区域的绝对坐标与检查点的相对坐标相加:

'  upperleft corner:
realCheckPointXduringRuntime = absX + cpRelX1
realCheckPointYduringRuntime = absY + cpRelY1

对于右下等,可以将坐标组合起来:

'  lowerright corner:
lrX = absX + cpRelX2
lrY = absY + cpRelY2

'  lowerleft corner:
llX = absX + cpRelX1
llY = absY + cpRelY2

'  upperright corner:
urX = absX + cpRelX2
urY = absY + cpRelY1

I do not exactly understand what you want. Maybe you can explain more in detail. For the time being, I give you some information you can use:

If you want the absolute coordinates of an object, use:

absX = myObj.GetRoProperty("abs_x")
absY = myObj.GetRoProperty("abs_y")

For the coordinates of an object relative to its parent, use:

relX = myObj.GetRoProperty("x")
relY = myObj.GetRoProperty("y")

To get the relative coordinates of the checkpoint of the text area, use:

cpRelX1 = CheckPoint("text area checkpoint").GetProperty("text_area_x1")
cpRelX2 = CheckPoint("text area checkpoint").GetProperty("text_area_x2")
cpRelY1 = CheckPoint("text area checkpoint").GetProperty("text_area_y1")
cpRelY2 = CheckPoint("text area checkpoint").GetProperty("text_area_y2")

If you want to have the absolute location of the CheckPoint during playback, you need to sum the absolute coordinates of the text area and the relative coordinates of the checkpoint:

'  upperleft corner:
realCheckPointXduringRuntime = absX + cpRelX1
realCheckPointYduringRuntime = absY + cpRelY1

For the lowerright etc., you just can combine the coordinates:

'  lowerright corner:
lrX = absX + cpRelX2
lrY = absY + cpRelY2

'  lowerleft corner:
llX = absX + cpRelX1
llY = absY + cpRelY2

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