How to capture error screen shot in qtp Result

Logging,reporting and Error handling are the most important challenge in Automation framework for any applications.We are using vbscript for automation framework but don't know how application is performing and taking the data from input data sources ex:excel,db etc ,in order to identify where actually what happen then we will go for Capture image fro every step  and store in results folder and below script will give you the details for QTP



You can capture bitmap in qtp using
Browser("browser name").CaptureBitmap "path to store"

but in order to save it in dynamically then we will go for separate function

Function CaptureImage()

Dim Capture,Image

Capture=Now() 
Image= Capture&".png"
Msgbox Image
Image = Replace(Image,"/","-")
Image = Replace(Image,":","-")
Image= "E:\Automation Testing"&Image 'Path to save the image

Desktop.CaptureBitmap Image,true
End Function

File will save it in specified path as below



Post a Comment

0 Comments