GetTOProperty、GetROProperty、GetTOProperties的区别

上一篇 / 下一篇  2012-08-20 17:29:31 / 个人分类:QTP

GetTOPropertyGetROProperty都用于取出对象的某个具体属性的值,它们的语法和用法几近相同,唯一的区别就是GetTOProperty取出的是录制对象的属性值,而GetROProperty取出的是在回放过程中运行的对象的属性值.51Testing软件测试网| x1~#\s

51Testing软件测试网:?Q2x7z:@Y:Wkf^~ M

GetTOProperties,是指取出录制对象的所有属性。51Testing软件测试网 kO3@#`q*lN!tgE

51Testing软件测试网q2j.^7p-vxVS

GetTOProperty和GetROProperty语法都是:

_YMmrs,Tj/Y*^#R7022551Testing软件测试网?9x@,ml[rw&Q

object.GetTOProperty(Property)51Testing软件测试网4u0g5[r"y6J4UL5}

51Testing软件测试网[.c&FG c~oL)I

或者是:51Testing软件测试网$W;z%e+c0v9zO/wt8LL

v H+y YI v70225object.GetROProperty(Property)51Testing软件测试网&A%KB!h:A&M

)wL,wR6?J.I70225其中Property,对象的属性,是必填项.

'F5I5\xm `P70225

%u3O'p q-v(sLg70225GetTOProperties的语法为:51Testing软件测试网#h{Q V'R}D
object.GetTOProperties

(i@'Z b$X`70225

.I8z'nU%K70225实例:

i1Xwq1F:X7022551Testing软件测试网R F:c3k-Z%G@1o

Dialog("Login").Activate51Testing软件测试网4^`'V;W }KE8j
Dialog("Login").WinEdit("Agent Name:").Set "training"51Testing软件测试网8uc,J9M }x}q)W
Dialog("Login").WinEdit("Agent Name:").Type micTab
#{v KTr8L3IOB70225Dialog("Login").WinEdit("Password:").SetSecure "429376f06698f739df8bb1c09eab3d78dee316f7"
3o+Zis_3@isDxp70225Set TableDesc = Dialog("Login").WinEdit("Password:").GetTOProperties51Testing软件测试网[l,E(rQ/Ek!r
Properties=TableDesc.Count51Testing软件测试网-R1W,r OVtpH
reporter.ReportEvent micdone,"属性数目",Properties51Testing软件测试网c6Xr)oJA1h
If Dialog("Login").WinEdit("Password:").GetROProperty("attached text")="Password:" then51Testing软件测试网&o~']#r9Oz
reporter.ReportEvent micdone,"name控件","存在"51Testing软件测试网gD O0R+`Ef T Z
else
)OU|"yE8Y(O.K t*S70225reporter.ReportEvent micdone,"name控件","不存在"
,br!Cn4^&}8L70225end if
6V^J)NXO6O4o Z70225If Dialog("Login").WinEdit("Password:").GetTOProperty("attached text")="Password:" then
Dh+_#y e[70225reporter.ReportEvent micdone,"name控件2","存在"51Testing软件测试网N u |$b%Ah\#n
end if51Testing软件测试网%R#b'xR3B1\q
Dialog("Login").WinButton("OK").Click51Testing软件测试网"r|E7|9}
'did the flight reservation window appear?
i0Q;X8G8g[3t!c70225Window("Flight Reservation").Check CheckPoint("Flight Reservation")51Testing软件测试网ZW UDe/P2Z
Set Mydes=Descrīption.Create()
1B5kJ$G8f$ur$r70225Mydes("attached text").value="Name:"
:D;?1eH5rP ?70225Mydes("nativeclass").value="Edit"

%v*w*VX1^d ^g6L E,sP v70225

{8R.d,{ h/f1aX70225Set winedites=Window("Flight Reservation").ChildObjects(Mydes)
+]"k]oI?7k"e]70225NoOfChildObjs =winedites.Count51Testing软件测试网Iw]^)f5fT&E
For Counter=0 to NoOfChildObjs-151Testing软件测试网(Y/bP^ d%Z,L
if(Counter=0) then51Testing软件测试网"|I"p,KI6{
winedites(Counter).Set "ON"51Testing软件测试网%|A N7U5tQ1R;s'Q%t)F
end if51Testing软件测试网`#a%j{9n#ck%R#k
Next


TAG:

 

评分:0

我来说两句

Open Toolbar