How do I get a screen capture of a object or window in UFT GUI?

  • Questions
  • How do I get a screen capture of a object or window in UFT GUI?
Question ID: 106564
0
0

I need to capture a bitmap of some windows for my reports. Does anybody have a suggestion?

Marked as spam
Posted by (Questions: 45, Answers: 1)
Asked on December 31, 2015 5:06 pm
28 views
Answers (1)
0
Private answer

To capture a bitmap image of an object or window from within the script, use the CaptureBitmap method.
Object.CaptureBitmap FileName, [OverrideExisting]
**FileName T**he full path of the (.png/.bmp) image to save. If you specify a relative path, the path is added to the test report path.
**OverrideExisting** A boolean value indicating whether the captured image should be overwritten if the image file already exists in the test results folder. (Default: False)
Example:

Dialog(''Login'').WinEdit(''Agent Name:'').Set ''mercury''
' Capturing a bitmap of the entire window
Dialog(''Login'').CaptureBitmap(''D:\Temp\Bitmap.bmp'')
' Capturing a bitmap of the Agent Name edit field
Dialog(''Login'').WinEdit(''Agent Name:'').CaptureBitmap(''D:\Temp\Bitmap2.bmp'')

After running the above code inside QTP or in a function library associated, you would find two bitmap images in the D:\Temp directory. Bitmap.bmp will obtain the screenshot of the entire Login window. Bitmap2.bmp contains a screenshot of the Agent Name edit field.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 31, 2015 5:09 pm