QTP里类(Class)的用法

上一篇 / 下一篇  2013-01-03 14:31:20 / 个人分类:QTP

Class User
' Public Function objBrowser()
'  Set bjBrowser = Browser("name:=百度一下,你就知道")
' End Function
' Public Function objPage()
'  Set    bjPage = objBrowser.Page("title:=百度一下,你就知道")
' End Function
' Public Function objWebEdit()
'  Set    bjWebEdit = objPage.WebEdit("name:=wd", "type:=text")
' End Function
 Public property Get objBrowser()
  Set bjBrowser = Browser("name:=百度一下,你就知道")
 End property
 Public property Get objPage()
  Set objPage = objBrowser.Page("title:=百度一下,你就知道")
 End Property
 Public property Get objWebEdit()
   Set objWebEdit = objPage.WebEdit("name:=wd", "type:=text")
 End Property
End Class
 
Set pUser = New User
pUser.objWebEdit.Set "hahaha"
 
以上代码,其实是实例化, 指定了objWebEdit 的具体实例。也就是在最后set的时候有点重用的意思。

TAG: aa QTP qtp 编程 技术

 

评分:0

我来说两句

Open Toolbar