Micro Focus QTP (UFT) Forums
Exist and Visible Are True When Objects Aren't There - Is there A Better Way? - 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: Exist and Visible Are True When Objects Aren't There - Is there A Better Way? (/Thread-Exist-and-Visible-Are-True-When-Objects-Aren-t-There-Is-there-A-Better-Way)



Exist and Visible Are True When Objects Aren't There - Is there A Better Way? - zunebuggy - 04-23-2018

I test a web application and it has about 34 screens that are similar but unique base on user selections. I have mapped out all the unique items on each screen and have a sub-routine that checks/verifies what screen I am on using .Exist and . GetROProperty("visible").  

The problem is, the developers are sloppy and sometimes they just hide a screen (I'm guessing this is what is happening) because I get a .Exist = True and/or GetROProperty("visible") = True when I cannot see those objects at all.  This is all due to poor programming, but all I want to do is determine what screen I am on and run the sub-routines that test that screen.  

There are many combinations/ways to get to the same screen in this web application, so it makes sense to test it this way.  Plus the user has First, <<Previous Next>> and Last as well as Back and Forward buttons they can click at any time and I need to test all these functions.  Plus there are selections on each screen that can take them to other screens or even take them back to screens they've already been on.  I know it sounds very kludgy and it is but they have complete redesign in the works but for the next two years, this UFT automation has to work.

Fortunately all of the screens have a unique title or some other object that lets me determine where I am so I can compare this with the expected result I have mapped.

Besides using. Exist and GetROProperty("visible"), is there another way?  Or maybe there is a completely different way to recognize screens.  I noticed that with the exception of one screen, all 34 screens also have unique URLs.  Maybe I could use that?

Thank you


RE: Exist and Visible Are True When Objects Aren't There - Is there A Better Way? - zunebuggy - 04-23-2018

What would be great is a Do Loop.. Until {any of these 34 pages is open}

and then Determine which of the 34 pages is open by URL

That is what I cannot figure out how to do.

Do I use Browser("").CheckProperty("status", "done", 3000) to check each page? There has to be a better way.


RE: Exist and Visible Are True When Objects Aren't There - Is there A Better Way? - zunebuggy - 04-23-2018

If I can just find a way that every time a new web page is loaded, I can get the Title and the URL, this would be all I require.  I could do the rest.  I tried search for examples of this and they do not work.

I am testing in IE 11 (this is what the app was written for) AND despite the fact that I successfully ran:

regsvr32 -u "C:\Windows\SysWOW64\BHOManager.dll" AND regsvr32 "C:\Windows\SysWOW64\BHOManager.dll" as Administrator and both Succeeded I do not have the IE 11 BHOManager Add-On.

I have the HP Functional Testing Agent which means that I cannot use dynamic terms like:

Browser("miclass:=browser").Page("miclass:=page").    etc.

I know at every point in my script where the page changes.  I just want a Sub-Routine that waits for the page to completely load and tell me the Title and the URL.

Also I noticed in Object Repository, name, title and opentitle are all the same.  I am curious as to what is the difference?

Thank you


RE: Exist and Visible Are True When Objects Aren't There - Is there A Better Way? - Ankur - 04-24-2018

I know at every point in my script where the page changes.  I just want a Sub-Routine that waits for the page to completely load and tell me the Title and the URL

As you rightly mentioned, check for the page loading status 


Code:
Browser("Browser").Page("Page").object.readyState

then get the URL/Title

Code:
msgbox Browser("Browser").Page("Page").GetROProperty("url")
msgbox Browser("Browser").Page("Page").GetROProperty("title")