Forum Discussion

geneticmaterial's avatar
geneticmaterial
Contributor
2 years ago

Detect URL change in TestComplete

I need to assert the contents of a URL as a user navigates through a site.

We use Chrome and CANNOT use any other browsers.

I initially looked to use events, specifically 'onwebpagedownloaded', to then run some javascript code to execute the content assertions:

https://support.smartbear.com/testcomplete/docs/reference/events/onwebpagedownloaded.html
However, this is not an option for Chrome:

 

One way to do this would be to inject a script routine for every known page/url change on every keyword test, something I am keen to avoid.

 

Any ideas on what I could try? Custom event?

 

Thanks

Dan

8 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Depends on what you mean by "assert the contents of a URL". Are you looking for specific content or you just want to make sure the page loads?

  • Hi.
    So when the customer interacts with certain items on our site, the URL will be populated with a specific item, this is what I want to detect. I'm aware I can use property checkpoints to check the page loaded, however I wanted to use the event function onwebpagedownload to execute this rather than run a script routine at every single point (in the test) where the customer traverses to a new page.

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      So when the customer interacts with certain items on our site, the URL will be populated with a specific item

       

      I take from this that you want to check the URL itself and not something on the page. Would you give us an example of what's happening and what you would like to check?

      • geneticmaterial's avatar
        geneticmaterial
        Contributor

        When a s user is logged in and they select an option from a menu we have on page, the page URL is populated with "data=menu". This is what I want to detect. I know how to get the URL etc and do the check myself.

        As said, what I don't want to do is run a script routine each time the user has clicked into these options, I wan this to be done by the system using https://support.smartbear.com/testcomplete/docs/reference/events/onwebpagedownloaded.html

        as these option selection and subsequent URL populations will always be a new page load, but that doesn't work for Chrome.
        My question is this:
        Can the function in the above link "onWebPageDownload" be implemented somehow for Chrome