Regular Expression example in qtp

Regular Expression Example :

(Login to the Flight Reservation Application,Open orders and Send Fax

Orders)

While Sending fax orders ,the fax order window would change for different

orders,so there we need to add Regular Expressions

Action1 :  (Login To the Flight Reservation Application)

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 : (Open Orders)

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 : (Send Fax Orders)

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 : (Close the application)

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

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

Here we are adding Regular Expressions

Goto Expert Veiw–Action3

rht click on  Dialog(“Fax Order No. 1″) goto object propert1es

goto Fax Order No. 1 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.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>