如何识别qtp中特定对象的索引

发布于 2024-09-16 19:05:42 字数 195 浏览 2 评论 0原文

我有表单,该表单包含 JavaStaticText 字段、组合框和文本字段。我想要该表单中所有项目的索引。我尝试获取检查点和获取属性,但没有获取索引。如何获取特定索引,

例如:

Name XXXX
Job  XXXX
Country XXXX

我想要分别包含姓名、工作、国家、XXX 的索引。

I have form, the form contains JavaStaticText fields, and Combo box, and Text fields. I want index of all the items in that form. I tried to get checkpoints, and GET properties but I didn't get the index. How to get particular index,

For example:

Name XXXX
Job  XXXX
Country XXXX

I want index of Name,Job,Country, XXX individually.

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

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

发布评论

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

评论(1

反目相谮 2024-09-23 19:05:42

我不确定我是否理解您要做什么,这里有一些代码获取 calc.exe9 按钮的索引,您可以基于您对此的解决方案或解释它与您想要做的事情有何不同。

Set Children = Window("Calculator").ChildObjects()
For i = 0 to Children.Count -1
     If Children(i).GetROProperty("text") = "9" Then
        MsgBox "The index of 9 is " & i
        Exit For
    End If
Next

编辑:来自另一个问题你问我看到你正在使用属性class_index,如果这是你想要的,只需执行以下操作:

JavaWindow("abc").JavaObject("xyz").GetROProperty("class_index")

I'm not sure if I understand what you're trying to do, here's some code that gets the index of the 9 button on calc.exe, you can either base your solution on this or explain how it differs from what you're trying to do.

Set Children = Window("Calculator").ChildObjects()
For i = 0 to Children.Count -1
     If Children(i).GetROProperty("text") = "9" Then
        MsgBox "The index of 9 is " & i
        Exit For
    End If
Next

Edit: From another question you asked I see you're using the property class_index, if this is what you want just do:

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