Highlighted
Dharmeshkumar V Absent Member.
Absent Member.
618 views

Regular Expression in QTP

Jump to solution
Hi,

I have a Step in QuickTest Pro: Browser("Yahoo!").Page("Yahoo!").WebEdit("p").Set "google"

I want to add Regular Expression for Page object so that I can work when Page name changes from "Yahoo!" to "Yahoo! India" e.g.Browser("Yahoo!").Page("Yahoo! India").WebEdit("p").Set "google"

I added a regular expression for Page object in Object Repository: "Yahoo!\|Yahoo!India", but it is not working. Can anybody help me out how to use Regular Expression for Object Properties?
Tags (1)
0 Likes
1 Solution

Accepted Solutions
Cody Marcel Absent Member.
Absent Member.

Re: Regular Expression in QTP

Jump to solution
I assumed that the property in WebEdit was name, but change it if that was a different property.

Browser("Yahoo!").Page("title:=Yahoo.*").WebEdit("name:=p").Set "google"
0 Likes
8 Replies
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Regular Expression in QTP

Jump to solution
What does the Regular Expression you tried look like?
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Cody Marcel Absent Member.
Absent Member.

Re: Regular Expression in QTP

Jump to solution
I assumed that the property in WebEdit was name, but change it if that was a different property.

Browser("Yahoo!").Page("title:=Yahoo.*").WebEdit("name:=p").Set "google"
0 Likes
Absent Member.. shiv_p Absent Member..
Absent Member..

Re: Regular Expression in QTP

Jump to solution
("Yahoo!|Yahoo! India") should work ..!!

Confirm again, you have checked the Regular expression check box against the vale in OR.

Regards,
Shivaram
0 Likes
Dharmeshkumar V Absent Member.
Absent Member.

Re: Regular Expression in QTP

Jump to solution
Jan, I am using "Yahoo!\|Yahoo!India" (without double quote) as Regular Expression.

Cody, should I add this property directly in expert view?

Shivram, I have checked the Regular Expression checkbox against the value in OR, but it did not work.
0 Likes
Cody Marcel Absent Member.
Absent Member.

Re: Regular Expression in QTP

Jump to solution
Yes, you can either add the descriptive programming above to the expert view or add the regex Yahoo.* to the OR. It is your preference. If yo uuse desc prog in the Page(), you will also have to use it in the WebEdit though.
0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Regular Expression in QTP

Jump to solution
If you entered it the way you put it here, I guess that explains the problems you are having. "Yahoo!\|Yahoo!India" including the backslash means the vertical bar should be interpreted literally. Try removing the backslash - that will probably solve your problem.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Dharmeshkumar V Absent Member.
Absent Member.

Re: Regular Expression in QTP

Jump to solution
Thanks Rondy and Jan, I am able to run both way after using RegEx.
0 Likes
Dharmeshkumar V Absent Member.
Absent Member.

Re: Regular Expression in QTP

Jump to solution
Use of * in OR object name
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.