QTP tutorials & interview questions


Search more on QTP here

Example of WAIT

It is a simple forcible wait.

Make sure that only QTP should be open.

Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.

Go to Start->AllPrograms->QuickTest Professional->Sample Applications->Flight.

Enter Username as your first name (make sure to enter 4 or more characters).
(use tab to move to password textbox.)
Enter password as 'mercury.'
Click Ok.
When Flight Reservation window is open, go to File(Menu)->Exit.

It will record the code as below but one thing which I have added extra is Wait(5) in step 4 (just go to the expert view and add this line before the line which includes encrypted password).


1)SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
2) Dialog("Login").WinEdit("Agent Name:").Set "sachin"
3) Dialog("Login").WinEdit("Agent Name:").Type micTab
4) wait(5)
5)Dialog("Login").WinEdit("Password:").SetSecure "46ed14b628c7ae93e3a3ab35576f08fc424a6fb9"
6) Dialog("Login").WinButton("OK").Click
7) Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"