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
When QTP object wait time is 10 seconds, and in test script wait time is 5 seconds and in function library wait time is 2 seconds how much time does the wait occur? or which is given priority.
Explain the concept of object repository and how qtp recognises objects?
i can done the project with QTP in that time i can say how many members in my team size?
How can we extract data like "Details","Result","Time" from the 'Run Error' result generated in QTP after run time errors are generated during a run & import the details etc...into excel sheet
what is the difference betn QTP 8.0 AND PREVIOUS VERSION
What is difference between run time object and test object?
Give me detailed theritical explanation about keyword driven, hybrid framework, environment variables, hybrid frame work
How to test fly out menu in qtp?
What are the advantages of parameterization ?
What is fragmentation and paging?
Can I change properties of a test object?
How to suppress warnings from the test results page?
Can any one send me the QTP Basic Coding Samples?
What is the syntax to call one script from another? And what can be the syntax to call one “action” in another?
How to create Reusable and Multiple Actions?