(二十四)QTP截屏

一、CaptureBitmap方法的使用【截整个桌面】
功能:Saves a screen capture of the object as a .png or .bmp image, depending on the specified file extension.

Desktop.CaptureBitmap Filename,[OverrideExisting]

应用:当Reporter.ReportEvent测试步骤为失败时,可以将截屏图片显示在步骤中,便于测试结果的分析

 Desktop.CaptureBitmap "error.png",True
 Reporter.ReportEvent micFail ,"日期是否为空","日期不为空","error.png"

二、对象截图
将Desktop改为Object

猜你喜欢

转载自blog.csdn.net/jiangshangchunjiezi/article/details/80712887