Sunday, September 22, 2019

13.1 CaptureBitmap Method





What is the function of CaptureBitmap method?

The function of CaptureBitmap method is to save a screen capture of the mentioned object as .bmp or .png file, with a specified name and at a specified path.


Syntax -: object.CaptureBitmap(FullFileName,[OverrideExisting])

Parameters – 1. FullFileName – Required. A String value.
            1. OverrideExisitng - A boolean value. Default value is False.


Return Type – None

Capture an image to the Results Folder

'The following example uses the CaptureBitmap method to capture
 'a screen shot of the No. of Passengers edit box. The file will
 'automatically be saved to a different folder (the test run
 'results folder) in each test run.

 Browser("Mercury Tours").Page("Find  Flights").WebEdit("numPassengers").CaptureBitmap "edit_4.bmp"
Capture an image to an Absolute Folder Path.

'The following example uses the CaptureBitmap method to capture
 'a screen shot of the No. of Passengers edit box and save the
 'image to an absolute path. Each time the CaptureBitmap statement
 'runs, UFT overwrites the previous image with the new one.

 Browser("Mercury Tours").Page("Find  Flights").WebEdit("numPassengers").CaptureBitmap "C:\ScreenCaps\edit_4.bmp", True

Capture an image and upload it to the Database

'The following example uses the CaptureBitmap method to capture an image, after which the image is
 'uploaded to the database.
 Browser("Browser").Page("The official site for").Image("PURE NEW  ZEALAND").CaptureBitmap ("c:\NewZealand.bmp")
 UploadImageToDataBase ("c:\NewZealand.bmp")



No comments:

Post a Comment