質問

I am trying the below code in QTP.

With msgbox s.count, I am getting an output of 5.

but I am not sure how to view those childObjects. Please suggest.

below is the code :

Set Login = Description.Create()
Login("regexpwndtitle").Value = "Login"
Set AgentName= Description.Create
AgentName("attached text").Value = "Agent Name:"
Set Password= Description.Create()
Password("attached text").Value = "Password:"
Set OK = Description.Create()
OK("regexpwndtitle").Value = "OK"
Set oFlightRes = Description.Create()
oFlightRes("regexpwndtitle").Value = "Flight Reservation"


Set oButton = Description.Create()
oButton("nativeclass").Value = "Button"
oButton("windowstyle").Value = "1342177291"


Dialog(Login).WinEdit(AgentName).Set "John"
Dialog(Login).WinEdit(Password).Set "Mercury"
Dialog(Login).WinButton(OK).Click
Dim s

Set s = Dialog(oFlightRes).ChildObjects(oButton)

msgbox s
役に立ちましたか?

解決

The easiest way to do this is by looping on the ChildObjects collection and printing the relevant properties you wish to view.

For example, you could try appending the following to the code above:

NumberOfButtons = s.Count()

For i = 0 To NumberOfButtons - 1
    print s(i).getROProperty("name")
Next
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top