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

Answers were Sorted based on User's Feedback



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

Answer / uday kumar. a

In QTP, delaing of Regualar Expressions and varing object
descriptions can be handled by using Description
Programming.
Ex. of using Regular expression is:
u just record yahoo login operaion and click on Inbox link.
Assume u got 10 new mails, then it shows like Inbox(10).
Read one mail, now it shows like Inbox(9). Now try to play
the recorded script. It wont work. Now use Regular
expression in Inbox link like:
"Inbox.*". At that time it wil work.

Is This Answer Correct ?    98 Yes 17 No

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

Answer / uday

ex
if we take flight reservation table (coz its easy to
understand the concept)
just record the script like this
go to file open order give no 5
and go to fax order type any fax no click send
and stop recording
then go to qtp script just change the script (the order no
to 6 )
Window("Flight Reservation").Dialog("Open
Order").WinEdit("Edit").Set "6"
and run the script we get the error as qtp could not
identify the fax order no 5
then go to repository select fax order no change the value
to "fax order no. *"
run it u get it

Is This Answer Correct ?    46 Yes 8 No

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

Answer / umasankar

Regular expressions enable QuickTest to identify objects
and text strings with varying values.You can use regular
expressions only for values of type string.

You can use regular expressions when:

1) Defining the property values of an object in dialog
boxes or in programmatic descriptions.

2) Parameterizing a step.

3) Creating checkpoints with varying values.

Example:

your site may include a form in which the user inputs data
and clicks the Send button to submit the form. When a
required field is not completed, the form is displayed
again for the user to complete. When resubmitting the form,
the user clicks the Resend button. You can define the value
of the button's name property as a regular expression, so
that QuickTest ignores variations in the button name when
clicking the button.

Is This Answer Correct ?    34 Yes 5 No

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

Answer / anil

Thanks Mr.Uday u explained beautyfully with an example. Can
u give another two more real time secnarios where we use RE.

Is This Answer Correct ?    10 Yes 5 No

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

Answer / 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

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

Answer / mahesh

Thax uday to give valuable information about regular
expression.

Is This Answer Correct ?    15 Yes 15 No

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

Answer / kavita

We can use regular expression where we have continous
change in value at run time (for e.g in dial up
connection,it takes 60 sec to get connected....)

Thanks

Is This Answer Correct ?    9 Yes 10 No

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

Answer / chandu

Hi kavitha ,

Can u tell briefly how to handle dial up connection using
the REGULAR EXPRESSION code.

Thanks & Regards
chandu

Is This Answer Correct ?    5 Yes 8 No

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

Answer / less than you

After doing till this point error will generate on fax no.
statement. And again on last statement.

Is This Answer Correct ?    4 Yes 8 No

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

Answer / rt

Thanks for u r giving information..

Is This Answer Correct ?    4 Yes 12 No

Post New Answer

More QTP Interview Questions

what is exact difference between smoke and sanity testing?

6 Answers   Satyam,


what is the frame work your using in automation testing

2 Answers  


What is the Difference between Environment variable and Globle variable,.. anybody can give me answer..Thanks in advance...

4 Answers   IBM,


How many types of recording modes in qtp?

0 Answers  


What is the difference between the design-time and run-time data tables?

0 Answers  


Is it possible to refer the same object for referring more than one object that are of different class using the descriptive programming approach? Suppose my code is 'To create the object named as obj Set obj=Description.Create() 'To define the values obj("title").value="IE" obj("type").value="text" obj("html tag").value="INPUT" 'To set the value Browser("IE").Page("Yahoo").WebEdit(obj).Set "xyz" Can I refer the "obj" object for the three objects like Browser,page and webedit objects? If so how?

0 Answers  


Hybrid framework supports Descriptive programming. Is it true?

0 Answers  


in data driven testing for performing operations which method is easy from manual test data,keyword view,or from database.and why?

0 Answers   Wipro,


What is object repository?

3 Answers  


how to identify an object which is not in the object repository identification can be done using descriptive programming.

2 Answers  


Suppose Object name was changed in the application in the second build.I have just modified the name in the Object repository as changes in the Application. Is it possible to accure changes in the script accordingly? If so Suppose I am calling the script through function, Will the changes affect in the script(which is in the function)automatically? If not affected, tell me the solution,How to handle this. How should I change the object property name while using functions

4 Answers   Livetek,


Is it possible to change the extension of Shared object repository?

2 Answers  


Categories