Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Use regular Expressions
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi

I need help in using regular expressions. I am practicing QTP and gone through some practice exercises given in the book. I am a bit confused with regular expressions. My book says that

* matches zero to any number of occurrences of the preceding character

. Matches any single character

I use regular expression on the Fax order on the sample flight application in QTP 8.2. I go to Flight app. File->Open Order. Give the order no.3 and click OK. In the flights menu bar I click file->fax order

Now I change the Fax order no: to 7 in the recorded script and the test fails. I insert a standard checkpoint on the title bar of FAX order no like this Fax order no.* and it doesn't work.

How do I insert a regular expression here. tried [0-9]+. Still not working

Any help please

Regards
Srinivas
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
Can you paste the Code

Regards
Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi
Below is the Code I have recorded.In the 6th Step ((WinEdit("Edit").Set "3"), I change the value 3 to 7 and Run it. The test will obviously fail as in the 12th step I insert a check point for "Send Signature with order" which will look for the Order no.3 in the title bar. I was asked to use a regular expression to handle the order no. in the title bar of the fax screen. I right clicked on the title bar in the active screen and tried to use the above regular expressions. But they are not working. I would like to know the exact syntax for the regular expression in the title bar

Code:
Window("Flight Reservation").Activate
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").Activate
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "3"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").Activate
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
Window("Flight Reservation").Dialog("Fax Order No. 3").Activate
Window("Flight Reservation").Dialog("Fax Order No. 3").WinCheckBox("Send Signature with order").Check CheckPoint("Send Signature with order")
Window("Flight Reservation").Dialog("Fax Order No. 3").WinButton("Cancel").Click
Window("Flight Reservation").WinButton("Button").Click
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
what you see here
Code:
Dialog("Fax Order No. 3")
is simply a view, changing values here won't matter, actual object identification happens in the Object repository(OR). Go to the corresponding OR change the value to regexpression of your choice and then test. It should work.

Also next time please put the formatted code.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#5
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi Ankur

Thanks for your reply. I went object repository and changed the constant value to a regular expression. But Still I have problems while running the test and the object is not recognized.
I started a new thread that will bring more clarity for what I am asking (Contains a jpeg image too). Please help me
Reply
#6
Solved: 11 Years, 4 Months, 4 Weeks ago
The new Thread is titled "Using regular expression" posted on 10/04/2008
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
At Regular Expressions for e-mail address ganesh.dengale 6 19,304 08-23-2022, 02:51 PM
Last Post: ahmad3029
  How to disable regular expressions in a text? ttralor 6 6,834 07-05-2013, 02:44 PM
Last Post: Staff
  Need help on using regular expressions on Java Window's title qa_tester 3 5,163 02-13-2012, 10:56 PM
Last Post: madsenfr
  java window titles & regular expressions jotdog2 1 4,277 02-13-2012, 10:55 PM
Last Post: madsenfr
  Process to use Regular Expressions in QTP using screen shots. yvslraotesting@gmail.com 1 3,542 01-31-2012, 12:45 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 2 Guest(s)