Tuesday, October 14, 2008

Sample script -2

'To insert a new record and to open and view the same ..
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"
'Inserting a new order
Dialog("Login").WinEdit("Agent Name:").Set "sundar"
Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure "48f47a499eb5b0bd47874d374eaf3616748868f0"
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").ActiveX("MaskEdBox").Type "1111111"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Activate "13544 FRA 12:48 PM LON 01:33 PM SR $168.50"
Window("Flight Reservation").WinEdit("Name:").Set "sundar"
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0,1
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Window("Flight Reservation").WinButton("Insert Order").Click
'set a synchronization point to wait till the text "Insert order" is visible.
Window("Flight Reservation").ActiveX("Threed Panel Control").WaitProperty "text", 1, 10000
'get the order number to a.
a=Window("Flight Reservation").WinEdit("Order No:").getvisibletext
msgbox "The newly created order no is :" &a
Window("Flight Reservation").WinButton("Button").Click
'Open the newly added record
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
'set the same order no 'a' to open that..
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").set a
wait 2
msgbox "Open the newly created order no :" &a
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").ClickWindow("Flight Reservation").WinButton("Button").ClickWindow("Flight Reservation").WinMenu("Menu").Select "File;Exit"

No comments: