|
余老师,帮忙看下下面这段代码:
'Step 1--------------------------------------------
systemutil.Run "www.51testing.com" '启动IE并进入指定网站
Browser("micClass:=Browser").Navigate "http://bbs.51testing.com/" '在当前窗口中直接跳转到其它网页
Browser("micClass:=Browser").Page("micClass:=Page").Sync:Wait 1 '保证当前页面的工作完全结束,然后再去做后续的事情
'checkpoint start -------------------------------------->
'通过自身属性借口获取当前浏览器的URL用于STEP 1的验证
checkURL=TRIM(Browser("micClass:=Browser").Object. LocationURL)
'msgbox checkURL
if checkURL="http://bbs.51testing.com/" Then
Reporter.ReportEvent micPass,"step 1","pass"
else
Reporter.ReportEvent micFail ,"step 1","faile"
End If
'end of checkpoing <-----------------------------------------
'Step 2---------------------------------------------------------------------------
Browser("micClass:=Browser").OpenNewTab
testHWND=Browser("name:=导航已取消").GetROProperty("hwnd")
'msgbox testHWND
Browser("name:=导航已取消").Navigate "bbs.51testing.com"
'step 3 -------------------------------------------------------------------------------
Browser("51Testing软件测试论坛_首页").Page("51Testing软件测试论坛_首页").Link("登录").Click
With Browser("51Testing软件测试论坛_首页").Page("51Testing软件测试论坛_登陆界面")
.WebEdit("username").Set "lmj19851117"
.WebEdit("password").Set "lmj19851117"
.WebButton("登录").Click
End With
'checkpoint start------------------------------->
oExist=Browser("51Testing软件测试论坛_首页").Page("51Testing软件测试论坛_首页").Link("退出").Exist
If oExist Then
Reporter.ReportEvent micPass ,"step 3","pass"
else
Reporter.ReportEvent micFail,"step 3","faile"
End If
'end of checkpoint <---------------------------------
'step 4 ---------------------------------------------------
'msgbox testHWND
Browser("hwnd:="&testHWND).Close
Browser("micClass:=Browser").Refresh:wait 1
'checkpoint start------------------------------->
oExist=Browser("51Testing软件测试论坛_首页").Page("51Testing软件测试论坛_首页").Link("退出").Exist
If oExist Then
Reporter.ReportEvent micPass ,"step 4","pass"
else
Reporter.ReportEvent micFail,"step 4","faile"
End If
现在的问题是在执行Step3的登录步骤时,为什么会跑到第一个选项卡去登录,而不是第二个选项卡? |
|