用心做人,用心做事!

GetTOProperty、GetROProperty、GetTOProperties的区别

上一篇 / 下一篇  2009-08-21 12:28:55 / 个人分类:QTP

GetTOProperty和GetROProperty都用于取出对象的某个具体属性的值,它们的语法和用法几近相同,唯一的区别就是GetTOProperty取出的是录制对象的属性值,而GetROProperty取出的是在回放过程中运行的对象的属性值.
GetTOProperties,是指取出录制对象的所有属性。
GetTOProperty和GetROProperty语法都是:
object.GetTOProperty(Property)
或者是:
object.GetROProperty(Property)
其中Property,对象的属性,是必填项.
GetTOProperties的语法为:
object.GetTOProperties
实例:
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "training"
Dialog("Login").WinEdit("Agent Name:").Type  micTab
Dialog("Login").WinEdit("Password:").SetSecure "429376f06698f739df8bb1c09eab3d78dee316f7"
Set TableDesc = Dialog("Login").WinEdit("Password:").GetTOProperties
Properties=TableDesc.Count
reporter.ReportEvent micdone,"属性数目",Properties
If Dialog("Login").WinEdit("Password:").GetROProperty("attached text")="Password:" then
reporter.ReportEvent micdone,"name控件","存在"
else
reporter.ReportEvent micdone,"name控件","不存在"
end if
If Dialog("Login").WinEdit("Password:").GetTOProperty("attached text")="Password:" then
reporter.ReportEvent micdone,"name控件2","存在"
end  if
Dialog("Login").WinButton("OK").Click
'did the flight reservation window appear?
Window("Flight Reservation").Check CheckPoint("Flight Reservation")
Set Mydes=Descrīption.Create()
Mydes("attached text").value="Name:"
Mydes("nativeclass").value="Edit"

Set winedites=Window("Flight Reservation").ChildObjects(Mydes)
NoOfChildObjs =winedites.Count
For Counter=0 to NoOfChildObjs-1
if(Counter=0) then
       winedites(Counter).Set "ON"
  end if
Next

TAG:

 

评分:0

我来说两句

Open Toolbar