Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Regular Expressions
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi

I have started this new thread on this subject as my previous thread did not clarify me.

Example1:

I start to record a business process using QTP, Open http://www.hotmail.com, Sign in using my user ID and password. Click on Inbox(6), Read one mail and Sign-out. Now the Inbox link after reading one mail will become Inbox(5). Now on play back the test will fail as the test will search for Inbox(6).

I would like to know how to assign a regular expression in the object repository for the above case. Exact syntax would be of great help .

Example 2:

This is the flight application that comes with QTP

   

I attached a .jpeg image in this thread. In the attachment you can Find the window titled Fax order no.29. How do I insert a regular expression to this Fax order title so that the playback can handle any number. I tried with few syntax but object not found errors are occurring while running the script

Any help please??

Regards
Srinivas
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Please help me on the above thread. Your help is highly appreciated
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
Locate the Inbox(5) object in the object repository and select the name property and then click on <hash> then you get value configuration options select Regular Expression option.

Hope this solves your problem..
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
You can use in the Object Repositiory something like below:
Inbox(6) will be in your obj rep. Change it to Inbox.* using the regular expression format. So whatever comes after Inbox, QTP will not care. It will look only for Inbox

Thanks
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
the best way for this is you can change the Object REpository to Regular Expressions with the format

Inbox(\d*)
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Follow these steps
1. Open OR
2. Select the Fax Order No
3. In Test object details select the text value
4. Open the Value configuration options
5. Change the value [0-9]
change only numeric value
if fax order no is two digit no then write [0-9][0-9]
6. Check on Regular expression check box
7. Click No

Run your script


Attached Files Image(s)
       
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hey All,

This is all good stuff. I was wondering about the difference between your solution of:
Inbox(\d*)

and the solution of the previous thread of:

Inbox.*

What are the benefits and drawbacks of each of these very similar solutions?

Thanks,
Brian
Reply
#8
Solved: 11 Years, 3 Months, 3 Weeks ago
The difference would be:

Inbox(/d*) -- /d* means "digits"...0-9 and any length "*"
Inbox* -- anything after "Inbox" alpha, numeric, or special chars and any length
Reply
#9
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks for the reply. Does the Inbox(\d*) speed up the execution of the statement in the script at all?
So if you have say 1000 of these expressions and you are more specific in regards to what the following character can be (digits, character) (\d*) rather than just .* does that help optimize your scripts? Or does QTP not really care?
Reply
#10
Solved: 11 Years, 3 Months, 3 Weeks ago
To the best of my knowledge one does not process any faster/slower than the other. the only difference would be in the pass/fail with what is allowed after "Inbox".
Reply


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

Forum Jump:


Users browsing this thread: 2 Guest(s)