Forum Discussion

mesg2anil's avatar
mesg2anil
Regular Contributor
13 years ago

Wait till the object loads on the page

Hi,



Just want to know if there is any way to make the TC wait till the object is enabled / loaded completely on the page. I gave "Delay XXXX" time to wait till the object is loaded, but it will waste lots of time in this process.



To make TC wait till the page is loaded, I can give as below

    Set Page1 = Sys.Process("iexplore", 2).Page("http://" + ProjectSuite.Variables.ServerName + "/Default.asp")

    Call Page1.Wait

Similarly, is there a way to make TC wait till the object is loaded instead of using Delay feature?

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    You can simply use "WaitChild" for the object and loop until "Exists" is true.
  • mesg2anil's avatar
    mesg2anil
    Regular Contributor
    Hi Robert,



    Thank you for replying...

    I've more than 30 - 40 objects on each page, for which I'll have to use WaitChild which will be too much of scripting... is there any other way to make the TC wait till the object is loaded as simple as below code which will make the TC wait till the page is loaded...



    Set Page1 = Sys.Process("iexplore", 2).Page("http://" + ProjectSuite.Variables.ServerName + "/Default.asp")

        Call Page1.Wait
  • VLapidus's avatar
    VLapidus
    Frequent Contributor
    Anil,



    Wait and ToUrl methods should work in your case as they allow to wait till a web page is loaded, that is, all objects appear on it. Also, you can find alternative approaches in the Waiting For Page article.
  • mesg2anil's avatar
    mesg2anil
    Regular Contributor
    Hi Ncoes,



    I'm using below code to make the script wait till the page is loaded completely...



    Set Page1 = Sys.Process("iexplore", 2).Page("http://" + ProjectSuite.Variables.ServerName + "/Default.asp")

        Call Page1.Wait



    but my concern is with page objects, once the page is loaded, I've drop down objects and links which will open popup windows. For example in case of drop-down objects, when I select a value from first drop-down, the second drop-down object will take few seconds to get the details related to first drop-down object value, in this process TC is failing as TC dosent find mentioned value in that second drop-down object. For this i'm currectly adding "Delay" so that the second drop-down object gets ready with details. For this if I use the above code "Call Page1.Wait"; it is not working as page is already loaded.



    Like this, I have multiple drop-down objects on single page in the application, suggest me best way to make TC to wait for the object without wasting huge time and less scripting as well.