QTP中getTOProperties的用法

技术流评论6,781阅读模式

getTOProperties是获取属性数量,例如一个对象,在对象库中已添加的属性有name, type, class三种,则该对象返回值为3。

请看如下例子(测试前请将Google首页加入对象库)文章源自原紫番博客-https://www.yuanzifan.com/511.html

Set oWebEdit=Browser("Google").page("Google").webedit("q") '首先设置对象文章源自原紫番博客-https://www.yuanzifan.com/511.html

Set TOProps=oWebEdit.getTOProperties() '把这个对象的所有属性设置到TOProps之中。
Dim i, iCount
iCount=TOProps.Count-1 '获取属性数量
For i=0 to Icount
Sname=TOProps(i).Name
sValue=TOProps(i).Value
isRegularexpression=ToProps(i).Regularexpression '判断该属性是否被正则
Msgbox sName& "->" & sValue & "->" & isRegularexpression '输出属性值
Next文章源自原紫番博客-https://www.yuanzifan.com/511.html 文章源自原紫番博客-https://www.yuanzifan.com/511.html

 最后更新:2013-12-10

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证