Browser.goto in firewatir doesn't wait for page to completely load

206 views
Skip to first unread message

Phoenix

unread,
Aug 20, 2008, 10:57:28 AM8/20/08
to Watir General
We are in the process of trying to run all our Watir tests in Firefox
with Firewater. One of the issues I'm running into is having the page
load completely before the next step/command is executed.

One of our URL's to our login page does some redirects through an
authentication server before loading the main page. In IE, the .goto
command will wait until the redirects complete and the page loads all
the elements. In FF, the .goto command executes, then before the
redirects are complete, the next command executes, which is trying to
access an element on the main page.

I've done some searching, and all I'm coming up with is that IE
returns a readystate code and FF doesn't seem to adhere to the same.
Most of the results I found were to code the page differently, and
unfortunately that isn't an option in our case.

Any new leads on this would be much appreciated.

Željko Filipin

unread,
Aug 20, 2008, 11:13:09 AM8/20/08
to watir-...@googlegroups.com
On Wed, Aug 20, 2008 at 4:57 PM, Phoenix <esd....@googlemail.com> wrote:
> In FF, the .goto command executes, then before the
> redirects are complete

Phoenix

unread,
Aug 20, 2008, 3:12:12 PM8/20/08
to Watir General
Thanks for the link - some of those methods will work in a round about
sort of way, but I'm still trying to get to the root of the problem.

I think I found out why it's skipping to the next step so quickly, the
first time I run it, cleared cache and all, the test passes (meaning
FF actually waits until the first page is loaded) Then any more runs
of the same test, it starts to load the first url, then immediately
loads the next one, not waiting again for the first to load.

So, it must be something to do with what FF is caching. In watir, it
is easy to clear cookies and cache, but I can't seem to find the
equivalent for FF.

Does anyone know how to clear the cookies/cache for FF in Ruby/watir?



On Aug 20, 9:13 am, "Željko Filipin" <zeljko.fili...@gmail.com> wrote:

Phoenix

unread,
Aug 20, 2008, 3:28:57 PM8/20/08
to Watir General
OR - if I can't clear the cache, then is there a way to start the
browser similar to the action of shift-click to tell the browser to
ignore any cached pages and download them anyways?
> > --http://WatirPodcast.com/4/- Hide quoted text -
>
> - Show quoted text -

Željko Filipin

unread,
Aug 20, 2008, 3:31:17 PM8/20/08
to watir-...@googlegroups.com
On Wed, Aug 20, 2008 at 9:28 PM, Phoenix <esd....@googlemail.com> wrote:
> is there a way to start the
> browser similar to the action of shift-click to tell the browser to
> ignore any cached pages and download them anyways?

You can set FF not to cache anything. Let me know if you need help with that.

Željko

Paul Rogers

unread,
Aug 20, 2008, 4:08:35 PM8/20/08
to watir-...@googlegroups.com
to get firefox to always load a page and dont do any caching,

in the address bar type

about:config

search for

browser.cache.check_doc_frequency

and this page
http://kb.mozillazine.org/Browser.cache.check_doc_frequency

will tell you what to set.

I think this is set on a per user basis, so make sure you do it on the
firefox profile that you intend to use for testing


Paul

Phoenix

unread,
Aug 21, 2008, 12:19:48 PM8/21/08
to Watir General
Thanks for both your responses.

I've tried setting the doc frequency (to each of the possible values),
clearing all private data (also set to clear on browser close) and the
same problem exists.

I think I've narrowed it down to the wait method in firewatir.rb. If
I run a test that just loads our login page url with credentials, the
test completes before the browser even gets to the final redirected
page (I believe there are 3 or 4 redirects)

So, I'm currently looking into how firefox checks to see if there is a
redirect, and if it waits for that page, which also has a redirect,
etc. I noticed that there are some comments in the method about
having to do an extra check for js redirects, since the command is
being sent through jssh and it doesn't look like it handles it.

I'll post back when I've found something more conclusive. Thanks
again.

Emily

On Aug 20, 2:08 pm, "Paul Rogers" <paul.rog...@shaw.ca> wrote:
> to get firefox to always load a page and dont do any caching,
>
> in the address bar type
>
> about:config
>
> search for
>
> browser.cache.check_doc_frequency
>
> and this pagehttp://kb.mozillazine.org/Browser.cache.check_doc_frequency
> >> > --http://WatirPodcast.com/4/-Hide quoted text -
>
> >> - Show quoted text -- Hide quoted text -

Phoenix

unread,
Aug 21, 2008, 4:04:11 PM8/21/08
to Watir General
Just a quick update - I realized that we are not using javascript for
the redirects, they are http redirects, and the only check in the wait
method currently is for javascript redirects.

Still digging...
> > >> > --http://WatirPodcast.com/4/-Hidequoted text -
Reply all
Reply to author
Forward
0 new messages