From: Bret Pettichord <
bret@pettichord.com> Mailed-By: gmail.com
To: Jonathan Kohl <
jonathan@kohl.ca>
Date: Sep 24, 2006 1:18 AM
Subject: Re: Watir not waiting for page to load
Jonathan,
Thank you very much for sharing this information. I have not been
watching BrowserUnit very closely and i suppose maybe i should be.
I took a look at the BrowserUnit code. IsNavigating is a variable that
is maintained by Browser Unit code that intercepts the BeforeNavigate
(true) and NavigateComplete (false) events. I think we can also
intercept these events in Ruby, and will look into setting up a
similar mechanism.
Bret
- Hide quoted text -
On 9/23/06, Jonathan Kohl <
jonathan@kohl.ca> wrote:
> Hi Bret;
>
> I've been helping out with browserUnit, which is a Watir-like tool for .NET
> written in C#. John Kordyback contributed some code, and Achim Domma in
> Germany has written most of it. It has been slow going development-wise, but
> I really like the API because it is very close to Watir (unlike others, that
> look much more like IE Test.) A new release should be ready this month, and
> when combined with Nunit, Visual Studio and ReSharper, it fits nicely in a
> .NET-only shop. Developers jump at using a test tool in the language they
> are already using. Enough of the background info.
>
> I have been using the tool a little bit in a .NET shop, and had problems
> with timing. Specifically, a standard Google test would fail sporadically. I
> also had problems with browserUnit dll getting ahead of itself with an older
> Java web app I've been testing (the app runs slowly.) I ran the test that
> was failing through a debugger over and over while watching TV Thursday
> night, and found that about one time in twenty, at my watchpoint in the test
> code, a value I had never noticed before was "true". In the C# code, the
> value was "IsNavigating", and one in twenty times it was "true". I changed
> the code that waits for a page to load so that it would also wait for
> IsNavigating to be false, as well as readystate complete being true, and
> IE.busy being false, and the Google test worked, no matter what version I
> pointed it to, such as google.ca, google.co.in, etc. This filled in a blank
> for me on this problem in the email below.
>
> More background info: a couple of months after I sent you this email, I was
> investigating an Ajax-bug. There was an Ajax call in a web app that was
> getting called every thirty seconds, and a new Java object containing the
> CSS and HTML for the page was getting /appended/ on each call, rather than
> having the object destroyed after each read, and reloaded with the new
> information. This slowed test machines down to a crawl, because after a few
> hours of testing, Ethereal revealed to me that the packets being sent to the
> client machines were enormous. The lead developer and I tracked it down to
> the bug I mentioned in the code, and it was fixed quickly after that.
> However, while I was investigating the bug, Internet Explorer slowed to a
> crawl. I navigated to Google while this was happening, and noticed that the
> URL was changing -- there are obviously a lot of redirects whenever you use
> Google, based on cookies for your location, and other things. So this is
> what I observed when I started IE:
> -it loaded "about:blank" in the address bar first, very briefly
> -it then loaded the URL I set in Watir "
http://www.google.com"
> -when I entered a search term and hit enter, the URL changes as expected
> -when I landed on the results page, a occurred redirect to a different URL,
> such as
http://www.google.ca/searchreturnstuff
>
> Under normal use, I can't see these redirects at all because they happen so
> quickly, but when using a browser that is crawling along on a machine with
> barely enough memory left, I noticed these things. One thing I noticed was
> that the page said "Done" sometimes while the redirect was occurring, and
> that the IE image wasn't moving, etc.
>
> Finding "IsNavigating" being set to true sporadically when debugging filled
> in the blank for me on this. I have a strong suspicion that is the issue I
> pointed out below - rapid redirection isn't being caught.
>
> I'm not sure if this will help you or not, and I'm not sure if you can find
> "IsNavigating" through WIN32OLE or not. I thought you might be interested in
> my findings and what my hunch on this issue now is.
>
> -Jonathan