How to use Regular Expressions in QTP? give an example.

Answer Posted / vikas choubey

Some Times QTP does not recognize the application object
during second run Or it run first time successfully then
QTP gives an error cannot identified the application Window
object properties does not match with the test object. There
might be a case of window name /object name is getting
changed each time. Here we required the use of regular
expression

During Recording of Flight application QTP record the
flight application it identified the Fax order window name
property like this

It Text Property is Fax order 11

If you run this script Again it will give an error because
Fax order Window name will be

Fax order 12
Cannot identify the object “Fax Order No. 11″ (of class
Dialog). Verify that this object’s properties match an
object currently displayed in your application.

Line (1): “Window(“Flight Reservation”).Dialog(“Fax Order
No. 11″).Activate”.
Check regular expression check box A message will appear
click NO. Now change Text box value according to Regular
expreesion.

Fax Order No. 11 to Fax Order No.*

Here each time only last part getting changed here we use .*
as regular expression means it will check only Fax order No
text not whole string

Same case we can apply for different object properties if
they are getting changed

A regular expression is a string that describes or matches a
set of strings. It is often called a pattern as it describes
set of strings

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what difference between runtime object and text object and what property they have. whether they have same properties or different properties.

1699


how to find that tools work well with your existing system?

1397


To retrive the test data which tool vl use and whats basis u vl write test data? its urgent

1433


What are the factors on which script execution time is dependent?

600


what are the utilities and drivers

1833






How many types of actions are there in quicktest professional (qtp)?

526


What is an object repository?

591


How does QTP identify an object?

601


What is the difference in the global and action sheet in qtp?

562


Call to copy of an action and call to existing action… i know the diff but in real project how to use..? i want live scenario.pls help me..

1272


Hi. please provide license key for QTP 9.2, I have windows XP on my machine Thanks in Advance, moreshwar

2789


Can any one brief some detail on how the shared and action object repository utilized/implemented in a real time project. I already know how to make shared object repositor by saving OR as .tsr extension..I wanted the actual concept of implementation...couple of live examples will be highly appreciated. Thanks

1887


Difference between test object and run time object?

582


How to run a test using quicktest professional?

520


If the weblist is identified as webelement,and by clicking on webelement if the values are displayed,and if the values the values also identified as webelement.then how to fetch the values through script?

4680