Is there any function where we can capture a web screen to QTP test results. the parameters can be passed are Browser name and Page name.
The Screen Recorder can be used to capture the entire test execution into a movie file but i didn't kind of see any option or function to capture a particular webpage and return it to results.
i want to call this function where ever i need a screen shot by passing the page title. not the entire test execution.
Use below, Collected from QTP help.
Browser(strBrowser).Page(strPage).CaptureBitmap strPath, True
i have never seen bugs sleeping
Thanks Prince. this will save the screen shot to the specified location but i want to save the screen to QTP test results for the particular step
Then Check here [img]/images/graemlins/wink.gif[/img]
Function capture_desktop(Object, Method, Arguments, retVal)
datestamp = Now()
filename = Environment("TestName")&"_"&datestamp& ".png"
filename = Replace(filename,"/","")
filename = Replace(filename,":","")
filename = "C:\QTP_ScreenShots"&"\"&filename
Reporter.ReportEvent micFail,"image","&lt;<img src='" & filename & "'>"
Thanks prince and jbotash for providing the solution.
Just keep in mind that they are not compatible with QC test results. In the sense when someone else view results they won't see the images as they have hardcoded paths. You should use a shared server to export the test results files if you want.
Buy the NEW QTP Descriptive Programming Unplugged Book
** Download QTP Unplugged 2nd Edition eBook for FREE **
Try this :
Public Function snapScreenShot()
thisSSName = Year(tm) & "_" & Month(tm) & "_" & Day(tm) & "_" & _
Hour(tm) & "_"& Minute(tm) & "_" & Second(tm) & "_" & _ & ".bmp"
Desktop.CaptureBitmap thisSSName, true