Highlighted
Absent Member.. vzamoraz Absent Member..
Absent Member..
119 views

QTP/UFT support tips: Capture bitmaps programmatically

To capture a bitmap image of an object or window from within the script, use the CaptureBitmap method.

Object.CaptureBitmap FileName, [OverrideExisting]

Where Object is an QuickTest Professional object class. 

 

OverrideExisting is a boolean value indicating whether the captured image should be overwritten if the image file already exists in the test results folder. (Default: False)

Note:

By default, if an image with the specified file name already exists in the folder, this method does not overwrite the existing file. You can set the OverrideExisting argument to True to instruct QuickTest Professional to overwrite an existing image with the same file name. You can also specify the file as a relative path so that the file will automatically be saved to a different folder in each test run.

 

Example:

Dialog("Login").WinEdit("Agent Name:").Set "mercury"

' Capturing a bitmap of the entire window

Dialog("Login").CaptureBitmap("C:\Temp\Bitmap.bmp")

' Capturing a bitmap of the Agent Name edit field

Dialog("Login").WinEdit("Agent Name:").CaptureBitmap("C:\Temp\Bitmap2.bmp")

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

 

 

 

HP support
If you find that this or any post resolves your issue, mark it as an accepted solution.


Note: The Opinions expressed in my post are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any answerd posted."

 

Labels (1)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.