Single Post

Header

Sunday, September 30, 2012

Regular Expression example in qtp




Regular Expression Example :
Example :Suppose if we want to send fax order for 1,2,3,4 then
We can send those using regular expressions

Action1 :

systemutil.Run “C:\Program Files (x86)\HP\QuickTest Professional\samples\flight\app\flight4a.exe”
Dialog(“Login”).WinEdit(“Agent Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Agent Name:”).Type  micTab
Dialog(“Login”).WinEdit(“Password:”).SetSecure “4c0ba4645292b686779b42c81dd13093544face9″
Dialog(“Login”).WinEdit(“Password:”).Type  micReturn

Action2 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set DataTable(“order_no”, dtGlobalSheet)
Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
Window(“Flight Reservation”).Activate

Action3 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;Fax Order…”
Window(“Flight Reservation”).Dialog(“Fax Order No. 1″).ActiveX(“MaskEdBox”).Type “11111111111111″
WINDOW("Flight Reservation").Dialog("Fax Order No. 1").WinButton("Send").Click
Window(“Flight Reservation”).Activate

Action4 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).Close

Goto Global Data Table :
make “A” as “oder_no” and enter
1
2
3

Goto Expert Veiw–Action3

rht click on  Dialog(“Fax Order No. 1″) goto object propert1es
goto Fax Order No. 1 at the values click there u will get browse button open
then make the below
Fax Order No\. [1-3]
check Regular Expression and click no in the pop up
Excute it.

No comments:

Post a Comment