|
精通qtp书上202页:
- 'Step 1----------------------------------------------------------------------------
- SystemUtil.Run "www.51testing.com":Wait 10
- Browser("micClass:=Browser").Navigate "bbs.51testing.com"
- Browser("micClass:=Browser").Page("micClass:=Page").Sync:Wait 5
- 'checkpoint start------------------>>>>>
- checkURL = Trim(Browser("micClass:=Browser").Object.LocationURL)
- If checkURL = "http://bbs.51testing.com/" Then
- Reporter.ReportEvent micPass,"Step1","Passed"
- else
- Reporter.ReportEvent micPass,"Step1","Failed"
- End If
- 'Een of checkPoint<<<<<---------------
- 'Step 2 -------------------------------------------------------------------------
- Browser("micClass:=Browser").OpenNewTab:Wait 1
- testHWND = Browser("name:=新建选项卡").GetROProperty("hwnd")
- MsgBox testHWND
- Browser("name:=新建选项卡").Navigate "bbs.51testing.com":Wait 10
- 'Step3---------------------------------------------------------------------------
- Browser("51Testing软件测试论坛").Page("51Testing软件测试论坛").Link("登录").Click
- With Browser("51Testing软件测试论坛").Page("51Testing软件测试论坛")
- .WebEdit("username").Set "ycg300164"
- .WebEdit("password").Set "XXXXXXXX"
- .WebButton("登录").Click:Wait 10
- end With
- 'checkpoint -------------------------------->>
- oExist = Browser("51Testing软件测试论坛").Page("51Testing软件测试论坛").Link("退出").Exist (3)
- If oExist Then
- Reporter.ReportEvent micPass,"Step3","Passed"
- Else
- Reporter.ReportEvent micFail, "Step3","Failed"
- End If
- 'end of chencpoint <<-------------------------
- 'Step 4-------------------------------------------------
- Browser("hwnd:=" &testHWND).Close
- Browser("micClass:=Browser").Refresh:Wait 1
- oExist = Browser("51Testing软件测试论坛").Page("51Testing软件测试论坛").Link("退出").Exist (3)
- If oExist Then
- Reporter.ReportEvent micPass,"Step4","Passed"
- Else
- Reporter.ReportEvent micFail, "Step4","Failed"
- End If
复制代码 执行,不打开新选项卡,在testHWND获得句柄处报错,
有童鞋遇到过吗, |
|