![]() |
Regular Expression in Desc programming - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions) +--- Thread: Regular Expression in Desc programming (/Thread-Regular-Expression-in-Desc-programming) |
Regular Expression in Desc programming - jyoo - 03-03-2010 I have to handle city names using regex This piece of code works for single word city names like Boston,Austin --working for single word city Code: Browser("Hotels").Page("Hotels").Link("text:=Hotels in .*").Click If I have city names with 2 words or with . it blows up. Norfolk-Virginia Beach Tampa-St. Petersburg Bergen-Passaic Riverside-San Bernardino Orange county Please some one help me with this how to write for the above mentioned cities. Code: Browser("Hotels").Page("Hotels").Link("text:=Hotels in .*").Click RE: Regular Expression in Desc programming - surya_7mar - 10-05-2010 Above stmt should work, what was the error you are getting RE: Regular Expression in Desc programming - cdesserich - 10-06-2010 I'm guessing you are getting the "object's description matches more than one of the objects currently displayed in your application" error since you are not using more than one identification properties. Usually, you want to at least include "html tag", then if the text property of "text:=Hotels in .*" matches all of the "Hotels in" links on the page, you have to pick out which one you want to click with the "index" property. This will click the first "Hotels in" link: Code: Browser("Hotels").Page("Hotels").Link("html tag:=A", "text:=Hotels in .*", "index:=0").Click RE: Regular Expression in Desc programming - markQA - 02-13-2011 In addition to the previous comment, try this: Code: Browser("title=.*").Page("title:=.*").Link("name:=xxxx", "index:=0").Click |