Micro Focus QTP (UFT) Forums
If/Exist statement - 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: If/Exist statement (/Thread-If-Exist-statement)



If/Exist statement - mv8167 - 12-09-2011

I need to check if a webelement (Report Name) exists as it changes with each iteration.

I tried:
Code:
If Browser("Preferences").Page("Preferences").WebElement("crossreference").Exist(1)
…. In the OR I have regExp of webelement crossreference set to ReportName

and:
Code:
If Browser("Preferences").Page("Preferences").WebElement("innertext:="&ReportName”).Exist(1)
which i thought would work. But both get passed by.

Any ideas on how to better my If exists statement?


RE: If/Exist statement - supputuri - 12-09-2011

HI,

Can you let us know what regular expression that you used in OR?

there is a small correction in the second method i.e. DP
Code:
If Browser("Preferences").Page("Preferences").WebElement("innertext:=" & ReportName).Exist



RE: If/Exist statement - mv8167 - 12-09-2011

Supputuri,

Hi, thx for the info.

In my OR, I changed the webelement for crossreference innertext set to my variable ReportName (no quotes)

Sorry, I dont see any change in the code for:
Code:
If Browser("Preferences").Page("Preferences").WebElement("innertext:=" & ReportName).Exist

other than a space p-rior to &.

thx for your looking?


RE: If/Exist statement - mv8167 - 12-10-2011

I ended up using a different webelement to Exist off of and all is well now. Something is hookey with the crossreference. ;-)

thx for looking
(.) (.)
__>
~