Micro Focus QTP (UFT) Forums
What is the best way to validate text in a web page using QTP - 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: What is the best way to validate text in a web page using QTP (/Thread-What-is-the-best-way-to-validate-text-in-a-web-page-using-QTP)



What is the best way to validate text in a web page using QTP - kishore.gkk - 08-05-2010

Hi,
Open Gmail login page and click sign-in without entering credentials. Error message will be shown as "Enter your email address.". I want to validate this error message. What is the best way to automate this.
Please dont write oneliner that use regualr expression. Please write the code if regexp is required or not required. I tried the following and it is working. But i dont think it si the better way . If you have a better solution, please do sent it.
Code i used.
<<<<<<<<<<
Code:
Dim ExpectedString, Entirestring
ExpectedString = "Enter your email address."
Entirestring= Browser("Gmail: Email from Google").Page("Sign_In Page").GetROProperty("innertext")
If (InStr(1, Entirestring, ExpectedString,1) >1) Then
    msgbox("Text found")
    
Else
    msgbox("Text Not found")
End if
>>>>>>>

Thanks
krish


RE: What is the best way to validate text in a web page using QTP - Saket - 08-05-2010

Obviously no one will write oneliner for you as - "use regular expression" instead i may write "try using checkpoints"

btw, why do you think that its not a better way. it seems ok to me.