Forum Discussion

andrewa's avatar
8 years ago

TestComplete incorrectly identifying page loads

So I've got some automate tests that loop through code and visit the same pages over and over. Each of the pages is mapped in the NameMapping.


Some of these pages take awhile to load, so I wanted a dynamic way to wait for the pages rather than hard coded delay. I discovered the 'WaitAliasChild' method to have testcomplete wait till the page is actually present. I've also tried page.waits, and waiting for elements to exist on the page (WaitProperty(exists,'true) etc). Problem is, it seems like once a page is loaded once, TestComplete always things it's loaded.


For example,

I go into the name mapping for our login page, click Highlight, login page is highlighted. I log into the app, and try to highlight the login page, and it highlights the whole page again. It's like it 'remembers' it was on the page, so it still thinks the page is there.


Is there any way to get around this to avoid TestComplete 'remembering' what web pages have been loaded?

  • Also, page.RefreshMappingInfo() might help...

5 Replies

  • tristaanogre's avatar
    Esteemed Contributor

    How do you have your page mapped after the login? If they are two different pages, the page objects in your name mapping should have two different URL's.  If they don't you'll get the behavior you described.

  • AlexKaras's avatar
    Champion Level 3

    Also, page.RefreshMappingInfo() might help...

    • Colin_McCrae's avatar
      Community Hero

      It's also possible that subsequent pages are not actually pages, rather they may be frames or sub-elements of a single page. Hard to say without seeing it.


      But you can detect that as well. You can use the "ready state" of the page. This will/should only go to complete once EVERYTHING on the page has completed loading. Including sub-page-level events. On IE, this works fine. On Chrome, there is a bug in that it always shows "Ready" even if the page is still loading. It's a known bug in Chrome and has been there a LONG time. (it may have been fixed now, been a while since I looked) As a workaround, you can watch the page loading spinner on Chrome instead and wait for that to change. I've used this method in the past for pages with AJAX events on them and it works great.

      • andrewa's avatar

        I'll have to try the refresh mapping to see if that works. 


        Each page is mapped with the object type of Page and a dynamic URL.