QTP-如何查看子对象?
我正在QTP中尝试下面的代码 使用msgbox s.count,我将获得5的输出 但我不知道如何查看这些子对象。 请建议 代码如下:QTP-如何查看子对象?,qtp,Qtp,我正在QTP中尝试下面的代码 使用msgbox s.count,我将获得5的输出 但我不知道如何查看这些子对象。 请建议 代码如下: Set Login = Description.Create() Login("regexpwndtitle").Value = "Login" Set AgentName= Description.Create AgentName("attached text").Value = "Agent Name:" Set Password= Description.C
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
最简单的方法是在ChildObjects集合上循环并打印希望查看的相关属性 例如,您可以尝试在上面的代码中附加以下内容:
NumberOfButtons = s.Count()
For i = 0 To NumberOfButtons - 1
print s(i).getROProperty("name")
Next
同意。另外:可以调用s(i)。突出显示以指示哪个实例是哪个实例。视觉上。