|
余老师,书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
--------------------------------
运行时报错了:Object not visible
Line (43): "Browser("hwnd:=" &testHWND).Close".
为啥呀??????????????????????????????? |
|