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

Which recording modes need more memory?

589


What ate the Technologies supported by QTP?

648


Hi Sudhananda, plz send me the QTP framework with any diagram and PPTS . I want to switch to automatio, I done QTP from professional person, but he does not give me his knowledge properly. so pls help me Thaks send me on following address mirajkar.akash@gmail.com

1875


Print the Prime numbers in below format only up to 20(Need commas also) 1,2,3,5,7,9,11,13,17,19

1188


Explain about the test fusion report of quicktest professional?

535






Explain process of smart Identification in QTP?

603


any body can you help me what is the script to automate an comand promt

1981


In qtp is it possible to check broken links of a page?

591


Explain QTP using different development techniques ?

542


How to do call a output parameter from one action to another action??/

1877


Can we create user defined functions in qtp?

562


Why we use QTP ,We can use other tools like WR OrSilktest What r the options in Qtp that WR and Swilktest Does not have.

1855


how can i pass a "cript"as a parameter in to a function

1462


Explain the Different types of QTP test assets and their extensions?

607


If there is a change in the object type eg: A button is changed as link, 1. How to edit that in the shared object repository. 2.What options are available to edit the object within shared object repository other than copy from loca; 3.What would be the effect of the change in Coded Scripts within QTP and Functions stored in .vbs file which are loaded and used in QTP

1306