Forum Discussion

lucist's avatar
lucist
Occasional Contributor
14 years ago

Wait until a webpage is loaded

Hello!



I am testing a website by navigating through it's pages and searching for specific objects.



The problem is that when clicking on different buttons these will open new pages which are loading quite slow and my script won't find the objects until I call a WaitPage or insert a static Delay



WaitPage Method is requiring a String variable (URL) which needs to be hard-coded in order for the method to function correctly.



My questions :


  • is there any method that I can use to get and store automatically the URL of a page into a variable without hard-coding it? I am asking this because there are dozens of pages and it's quite hard to navigate through each page and save it's link into my script.

  • also, is there a way to determine if a page has finished to load/download ( Browser loading ) and then go to the next steps in the script?




Thank you,

Lucian
  • Hello Radu,


    is there any method that I can use to get and store automatically the URL of a page into a variable without hard-coding it?


    Unfortunately, you cannot get the web pages' URLs to variables automatically. You can create a set of the required variables and replace the hard-coded URLs in tests with those variables manually.

    To avoid hard-coded URLs in your tests, you can also try using wildcards, or you can map web pages.

    To learn how to do this, please see the following topics:

    Using Wildcards

    Name Mapping

    Mapping Web Page Elements


    also, is there a way to determine if a page has finished to load/download ( Browser loading ) and then go to the next steps in the script?


    To pause your test execution until a web page gets completely downloaded, you can use the ToURL or Page.Wait method. For more information on waiting for web pages to get completely downloaded, please see the Waiting For Page Help topic.


    Please let us know whether this information helps or whether you have additional questions.

    Thank you.