Micro Focus QTP (UFT) Forums
How to Sync on string or inStr - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to Sync on string or inStr (/Thread-How-to-Sync-on-string-or-inStr)



How to Sync on string or inStr - mv8167 - 11-20-2010

If I am doing a Sync point, and am looking for the outer text but only a part of the text string; Do I just place that part in double-quotes?

As in the string “Current Account: 26678625-DAVIS CHARLES M”, I only want to sync on 26678625 before the script continues.

Do I:
Code:
Browser("WisdomLogin").Page("Wisdom DEV_3").WebElement("Current Household:  None").WaitProperty "outertext", "26678625”, 5000

Or must I add a wild card?

Code:
Browser("WisdomLogin").Page("Wisdom DEV_3").WebElement("Current Household:  None").WaitProperty "outertext", "*26678625*”, 5000

Or how do I use inStr?

Lorena ;-)


RE: How to Sync on string or inStr - PrabhatN - 11-20-2010

Hi Lorena,

You just need to modify your 2nd line code as

Code:
Browser("WisdomLogin").Page("Wisdom DEV_3").WebElement("Current Household: None").WaitProperty "outertext", ".*26678625.*”, 5000

But 1 question here, is 26678625 always fixed or any number may come as a part of the outertext? If its dynamic then you need to regularize the number as well according to the specification like digit count in the number.

Let me know if you have any doubts.


RE: How to Sync on string or inStr - mv8167 - 04-20-2011

Yes, the number itself will change a it will be needed to compare to others. What do you mean "to regularize the number as well according to the specification like digit count in the number." thx

Lor


RE: How to Sync on string or inStr - Jay - 04-20-2011

if number of occurance are fixed then use [0-9]. if 3 numbers are there than use [0-9][0-9][0-9] times.