Post Reply 
 
Thread Rating:
  • 1 Votes - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Regular Expressions
10-04-2008, 11:21 PM
Post: #1
Using Regular Expressions

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
Find all posts by this user
Quote this message in a reply
10-06-2008, 08:30 PM
Post: #2
RE: Using Regular Expressions
Please help me on the above thread. Your help is highly appreciated
Find all posts by this user
Quote this message in a reply
10-08-2008, 04:16 AM (This post was last modified: 10-08-2008 04:18 AM by somisays.)
Post: #3
RE: Using Regular Expressions
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..

Regards
Sridhar
"Always Keep Smiling It Cost's Nothing For You"
Find all posts by this user
Quote this message in a reply
10-17-2008, 04:11 AM
Post: #4
RE: Using Regular Expressions
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



somisays Wrote: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..
Find all posts by this user
Quote this message in a reply
11-29-2008, 11:05 PM
Post: #5
RE: Using Regular Expressions
the best way for this is you can change the Object REpository to Regular Expressions with the format

Inbox(\d*)

Thanks
Surya
Find all posts by this user
Quote this message in a reply
10-14-2009, 01:24 PM
Post: #6
RE: Using Regular Expressions
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 File(s) Image(s)
       
Find all posts by this user
Quote this message in a reply
10-21-2009, 09:13 PM
Post: #7
RE: Using Regular Expressions
(11-29-2008 11:05 PM)surya_7mar Wrote:  the best way for this is you can change the Object REpository to Regular Expressions with the format

Inbox(\d*)

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
Find all posts by this user
Quote this message in a reply
10-22-2009, 12:50 AM
Post: #8
RE: Using Regular Expressions
(10-21-2009 09:13 PM)qatestbrian Wrote:  
(11-29-2008 11:05 PM)surya_7mar Wrote:  the best way for this is you can change the Object REpository to Regular Expressions with the format

Inbox(\d*)

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

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
Find all posts by this user
Quote this message in a reply
10-22-2009, 01:01 AM
Post: #9
RE: Using Regular Expressions
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?

(10-22-2009 12:50 AM)jsknight1969 Wrote:  
(10-21-2009 09:13 PM)qatestbrian Wrote:  
(11-29-2008 11:05 PM)surya_7mar Wrote:  the best way for this is you can change the Object REpository to Regular Expressions with the format

Inbox(\d*)

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

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
Find all posts by this user
Quote this message in a reply
10-22-2009, 01:08 AM
Post: #10
RE: Using Regular Expressions
(10-22-2009 01:01 AM)qatestbrian Wrote:  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?

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".
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help on using regular expressions on Java Window's title qa_tester 3 1,155 02-13-2012 10:56 PM
Last Post: madsenfr
  java window titles & regular expressions jotdog2 1 858 02-13-2012 10:55 PM
Last Post: madsenfr
  Process to use Regular Expressions in QTP using screen shots. yvslraotesting@gmail.com 1 494 01-31-2012 12:45 PM
Last Post: basanth27
  Regular Expressions Venkat Goturi 2 1,119 08-19-2010 06:22 PM
Last Post: Jyobtech
  Regular Expressions for SAP objects and "id" property bajer 1 1,088 04-27-2010 07:56 AM
Last Post: fyjm

Forum Jump:


User(s) browsing this thread: 1 Guest(s)