开发者

how to identify index of particular object in qtp

开发者 https://www.devze.com 2023-01-14 00:07 出处:网络
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 i

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 开发者_JAVA技巧Name,Job,Country, XXX individually.


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")
0

精彩评论

暂无评论...
验证码 换一张
取 消