Ticket #291 (new defect)

Opened 10 months ago

Last modified 4 weeks ago

waits.forPageLoad does not work in some cases

Reported by: rgonzomatic Owned by:
Priority: major Milestone: triage
Version: 1.1.x Keywords:
Cc: Dependencies:

Description

I have a web page that comes up after a login/password is entered. This is an ssl page. I put an assert in the page that comes up afterward. It just blows by the waits.forPageLoad even though the page is not loaded. So I added a waits.sleep 15000, but this was not enough, its slow for some reason. The waits.sleep is a hack. waits.forPageLoad should work and eliminate the need for the sleep hack.

Change History

Changed 10 months ago by mikeal

  • milestone changed from 1.2 to 1.3

1.2 is almost out the door, we're not taking bugs at this point in to this release that are not regressions.

Changed 10 months ago by adam

If you feel up to it, could you modify the integer 500 in windmill/html/js/waits.js to something higher? I think what is probably happen is that its taking just long enough to start the load that the forPageLoad doesn't have a chance to kick in. Knowing how high the number has to go before it starts working will help me to build a more dynamic fix for this.

Changed 10 months ago by adam

Sorry I forgot to add the line number: 231

Changed 10 months ago by rgonzomatic

I can get around it by using waitForElement. What release should I be submitting tickets against?

Changed 10 months ago by mikeal

Don't worry about logging in the proper release, as long as the bugs are getting logged we don't mind moving them around.

Changed 10 months ago by rgonzomatic

I made the 500 into 1500 (1.5s) and it worked. (in wait.js)

Changed 5 months ago by weiliang.lin

waits.forPageLoad uses whether 'document.body.style' exists to determine a page load done. I find that in some case this method can not work correctly. While a image doesnot load successfully, wait.forPageLoad fires and returns in advance.

Changed 5 months ago by weiliang.lin

Does anyone have any idea to solve this problem?

Changed 5 months ago by mikeal

waits.forPageLoad is basically "as good as it can be". Any and all reliable methods for figuring out an event when a page is really done loading are fudged by browsers in order to gain better performance on page load.

The best thing to do is wait for the element you want to interact with, or with the last element that needs to be loaded on the page. It's much more reliable than waiting for page load.

Changed 5 months ago by weiliang.lin

Is there any method to capture the onload event of the testwin?

Changed 5 months ago by mikeal

There is but it won't help you, onload fires long before the page is actually done rendering.

Changed 5 months ago by weiliang.lin

Now, primarily I need a mechanism which can work on firefox 3.5, not to consider various browser. Do you konw how to do it?

Changed 5 months ago by mikeal

Firefox *definitely* fires onload before all the rendering is complete.

You can't just wait for a specific element on the page?

Changed 5 months ago by weiliang.lin

I have many Pages which i need to wait for his load. When i use waits.forPageLoad, I find that it can not work as its name. If I go to wait for the last element, I need to find out manually which element is the last one and hard-code the element's id in the windmill's test script.

Changed 5 months ago by mikeal

Instead of trying to wait for the *last* element to load, wait for the element that you're going to need to interact with. That's the most reliable method.

It's not as simple as waiting for onload and we've been working on this for years, the Browser vendors make this incredibly difficult.

Changed 5 months ago by weiliang.lin

I have tried to wait for the element. But it also can not work. It returns before a picture is fully loaded, although it waits for the image element. Now the only work way is to modify the web application that I need to add a 'onload' event listener. when the page triggers the onload event, my event handler sets a flag, such as document.body.ready='done'. Then i poll this flag value on windmill's waits.forPageLoad function.If the value exists, I return true of waits.forPageLoad. This method can work correctly on firefox and it returns until the image is fully loaded. But the problem is that I need to modify the web application.

Changed 5 months ago by adam

I have just added a new method called: waits.forImageLoaded, this is in the master trunk source on github. This takes a locator and a timeout, instead of waiting for the page to load, you can wait for this image to load and give it as long a timeout as you would like.

Changed 3 months ago by jackiboa

Instead of trying to wait for the *last* element to load, wait for the element that you're going to need to interact with. That's the most reliable method.  Dissertations  Essays  Research Papers  Term Papers  Theses

Changed 4 weeks ago by sim

 decoration Changed 1 year ago by admin

 bathtub Changed 1 year ago by admin

 solar system Changed 1 year ago by admin

 stair parts Changed 1 year ago by admin

 solar supply Changed 1 year ago by admin

Note: See TracTickets for help on using tickets.