Anyone know how to check if page is loading before calling selenium waitForPageToLoad? (to avoid unnecessary exception)
(from Twitter - @marisaseal)
|
|
Anyone know how to check if page is loading before calling selenium waitForPageToLoad? (to avoid unnecessary exception) (from Twitter - @marisaseal) |
||
|
|
|
|
Justin, Just last week I needed to to this, and came up with the following scheme. Note that I use Perl to drive my Selenium RC tests.
The idea is to time how long it takes to load an element in the page. 1) start from another page that has a link on it to the page of interest
2) we then click on this link, and see how much time it takes for an element to appear. In my case, I am looking for a specific link "click_here" to appear. Om firefox 3.0 and safari 3.0 under windows XP, it takes about .6 seconds for the link to appear, adn about 2 seconds for the whole page. Internet Explorer 8 gives results that don't agree with the other - it may be that it waits for the whole page to load before the wait_for_element_present is tested. Corey has come up with a web_profiler that gives details on page loading. I used this scheme until I found his. Thanks, Marc Herbert |
||
|
|
|
|
which exception? An exception should only be thrown when waitForPageToLoad() time's out (page isn't loaded yet). why would you need to check if it is loaded beforehand? If you clarify further I can probably give you an answer. also, look at waitForCondition(). It might be more along the lines of what you are looking for. |
||
|
|
|
|
hmm - I'm far from a selenium expert, but would GetLocation() tell you the correct URL before the page is fully loaded? Seems like it should, but I haven't tried it. |
||
|
|
|
|
Can you someone tell me how Selenium checks for the page reload? In our app, the page looks like reloaded, however, it just one div is shown. Got some exceptions for that. |
||
|
|