QTP笔记--检查点、ChildObjects方法
一、自带检查点函数
'最后一个参数为timeout,单位是毫秒
1 Browser( "SAP NetWeaver Portal" ).Page( "SAP NetWeaver Portal" ).SAPEdit( "用户名" )._ 2 CheckProperty "value" , "tianyangln" , 2000
二、ChildObjects使用举例:
1 '点击Page页面的所有webButton 2 Set oDesc = Description.Create() 3 oDesc("micClass").Value = "WebButton" 4 Set Buttons = Browser("micClass:= Browser").Page("micClass:=Page").ChildObjects(oDesc) 5 NumerOfButtons = Buttons.Count 6 For i = 0 To NumberOfButtons - 1 7 Buttons(i).Click 8 Next
三、QTP报告
1 Reporter.ReportEvent micFail, "StepName" , "具体描述",[截图路径] 2 '报告状态有micFail,micWarning,micPass,micDone四种
四、Browser或Page的CaptureBitmap方法---对象截图1 FullFileName = "D:\test.png" 2 Browser("百度一下,你就知道").CaptureBitmap FullFileName,True 3 Reporter.ReportEvent micFail,"错误截图方法试用","错误截图写入报告",FullFileName
五、Browser的FullScreen方法,使浏览器全屏