UFT function to capture screenshots?

  • Questions
  • UFT function to capture screenshots?
Question ID: 107751
1
0

In UFT we would like a function to capture a screenshot at certain times, is there a way to do this in UFT and save the image to the run results?

Marked as spam
Posted by (Questions: 86, Answers: 3)
Asked on July 21, 2017 5:38 pm
5 views
Answers
1
Private answer

I have created a function below that you can try, just put the function in your UFT script/function library then call the UFT function whenever you want a screenshot.

Function CaptureScreenshot
'Written 6/26/2017 Joshua Yates Orasi Software
'Create File system object
Set fso=createobject(''scripting.filesystemobject'')

'Delete previous test image capture if it exists
If fso.FileExists(''C:TempMyUFTScreenshot.png'') then
fso.DeleteFile(''C:TempMyUFTScreenshot.png'')
End If

'Capture new image and save to report
Desktop.CaptureBitmap ''C:TempMyUFTScreenshot.png''
Reporter.ReportEvent micDone, ''Capture Screenshot'', ''Failure Screenshot'', ''C:TempMyUFTScreenshot.png''
Set fso=nothing
End Function

Marked as spam
Posted by (Questions: 0, Answers: 327)
Answered on July 21, 2017 5:40 pm
0
Private answer

Recommend using [CaptureBitmap method][1] if possible before writing custom code.

[1]: http://uft-help.saas.hpe.com/en/14.00/UFT_Help/Subsystems/FunctionReference/Subsystems/OMRHelp/Content/Common_Methods_and_Properties/Common_Methods_and_Properties.html#CaptureBitmap

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on July 21, 2017 6:30 pm