Method is some thing which is used by QTP
to Perform any action
is called a method.Example : Click, set …. Etc
1. Capture Bit Map() :
used for capturing a snap shot of an object during Execution
and storesin a desired location. When you want to send Defect to the developer, this captured bitmapcan also be sent in order to understand the error/defect easily.
ierarchy. captureBitmap “path of the location with a file name .bmp extension”
Window("Flight Applicaiton").Dialog("Open Order").WinButton("OK").captureBitmap (“d:\fa1.bmp”): captured snapshot / bit map will be stored in
drive with file name as
Put the tool under recording mode
Open the flight application
Enter username an password
Click on OK
After logged in , try to open an existing order by clicking on open order.
Open order window will appears
Assume that you find some errors on that window and want to capture bitmap for that window
At the end of present script ( or next line of the error’s window script) insert thecapture method (say OH. CaptureBitmap "d:\bop.bmp" )
Run the test
After Test is executed successfully and that bitmap/ snap shot will be stored in thelocation d:\bop.bmp
That you can send as attachment to the developer along with defect reporting.
2. Exist () :
The main purpose of this method is
check whether the object/ window is existing or NOT
.Exist method is used for checking the object’s existence. If the object is existingthen it will return TRUE and continue the execution. Otherwise , it will wait till the object exists or upto the maximum time. Meanwhile at any point of time the object exists it will return TRUE andcontinue its execution, otherwise, after the maximum time is finished it will return FALSE andcontinue its execution.* Exist method will make the QTP to wait till the default time Plus extra time (if any)
ierarchy. Exists [(Extra time in seconds]
Exaple : var = window(“flight application”).Exists (10)Msgbox var: gives True or false
Open the flight application and put tool in recoding mode
Open the order by clicking on open order, it will displays the open order window
Enter an existing order number and click on Ok. That order will be opened.
Now to check whether that window is available or not
put this code before that window’s scriptvar=Window("Flight Reservation").Dialog("Open Order").Exist(10)msgbox var : gives True or false