Tuesday 13 May 2014

Capture Bitmap Method in QTP



Saves the Screen capture of the object and saved with file ectension .png or .bmp depending upon the specified file extension.

Its used for store the screen capture of the test objects in QTP.


Syntax:

object.CaptureBitmap filename [override existing]

Object -> test object
Capturebitmap -> methode name
file name -> specified the full path file name with in quotes for wher we can stored the image file.
Override Existing -> True or False
        True -> the file override, if the file name already exists
        false -> defaulty QTP set as false, its not override.
Return Value : NONE

Ex:

Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").CaptureBitmap "E:\signin.bmp",True




Store screen shot hyperlink in excel using CaptureBitmap Method


Example Script:

Browser("Browser").Page("Order Summary").CaptureBitmap TestPath&"\Screenshots\"&"Number Of Access = "&NoOfAccess&".bmp",true
Linklocation =  TestPath&"\Screenshots\"&"Number Of Access = "&NoOfAccess&".bmp"
WS.Cells(i,12).value="=HYPERLINK("&""""&Linklocation&""""&","&""""&"Number Of Access = "&NoOfAccess&""""&")"


Here,

Testpath = Computer location used for save the screen shot


The above script used to capture the screen shot and saved into the perticular location. And stored as hyperlink in Excel.



Browser("Browser").Page("Order Summary").CaptureBitmap TestPath&"\Screenshots\"&Testcase&".bmp",true
Linklocation =  TestPath&"\Screenshots\"&Testcase&".bmp"
WS.Cells(i,12).value="=HYPERLINK("&""""&Linklocation&""""&","&""""&Testcase&""""&")"

No comments:

Post a Comment