Micro Focus QTP (UFT) Forums
If Then Is Always True For Web Objects - 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 Then Is Always True For Web Objects (/Thread-If-Then-Is-Always-True-For-Web-Objects)



If Then Is Always True For Web Objects - zunebuggy - 04-16-2020

With our web testing automation, we do a lot of repetitive testing and occasionally, I guess due to poor development or whatever, we get redirected to a 404 page or Server Error page or 500 page, etc.  I added objects from each of these pages to the Object Repository and added If Then statements for each of them.

The issue is, when the program comes to the line with the If Then, even though the page is not displayed anywhere, the objects still exist so the If Then is ALWAYS True.

What unique object property can I use in the If Then that will not be True unless the page is actually being displayed?

Thank you.
Smile


RE: If Then Is Always True For Web Objects - zunebuggy - 04-17-2020

I even got the properties of one of the web pages that the web app is redirecting to, and added them to the repository. The Browser and Page are completely different than the web app. So I did a msgbox at runtime on the Browser and Page, which by the way were NOT open, and did Browser("Browser").Page("Page").Object.ReadyState and it was "complete". Ugh!

I want to have my script chug along being happy, and IF and ONLY IF the web app should redirect me, THEN do some action. The only issue is, every property of the page I am checking for says the page is open when it isn't. I even tried "visible" in GetROProperty. It always is visible even when it isn't.

I have a subroutine that will close all browsers and reset my script. When I get redirected, I want to Call this sub.

Thanks again.