> Okay, so I need to tell my script to wait a few seconds (however long it
> takes actually) until the page is refreshed, so I inserted the following
> sleep command:
> ---
>       $ie.span(:index, 108).click
>
>       sleep 1 until $ie.span(:id, /NodeIdentifierLabel/).text != '.'

Nice use of "until".

Thanks.  Pierre Garigue added it to my 'vocabulary' in a reply last week and I've been finding great uses for it ever since.  =)


This not waiting is a little disturbing, though.  You say it happens
fairly often for you, too.  I wonder if there's some sort of common
cause for this?


I don't know for sure, but I have an idea of a possible related effect.  We have several Dot-Net web apps and this 'impatient' script behaviour seems to happen more often with one app that makes more use of frames than the others.

Some Background:  I had logged a bug with our app last year when I happened to be testing with a particularly slow and underpowered test server one day.  The bug was titled: "INQUIRY - Why does the IE Web Browser look like it stops working?"

Basically, the general idea was that when I clicked a tab or link or something on a certain page (not all of them), you notice the IE Browser's 'flag' icon start waving in the corner as it tries to complete the request, as expected.  However, if you then move the mouse, you see that the flag *stops* waving and browser control has returned to the user.  But the page hasn't completed the request or finished loading - so what gives?

The reply I got from Dev was : "Nothing we can do about this.  The flag is an indicator for loading the outer frame (ie the url in the address field of the browser).  On the really slow server you see this effect because the inner frame page takes a long time to load.  We see it all the time on our local machines as well."

I trusted that they didn't just feed me that line to make me go away. ;)  We never see this effect on our regular test servers or even with our Production servers because they are faster and more powerful, so I never gave it a second thought until I encountered these scripting quirks recently.

My Hypothesis:
- I think I read somewhere that Watir/Ruby is getting its "Ready to proceed" signal from the IE Browser and I suspect that the script is a bit premature at times because not all of the frames have finished loading when it must get the green light from the browser.

- With the script that I was working on today, there weren't any frames and I can't even visually see the delay between the click event and displaying the information on the page.  As far as my eye is concerned, it looked instantaneous.  However, when I put the "flash" line in there, I realised that Watir went *immediately* from the " span.click" command to the next line (zero wait).  So it found the "." that was already displayed there but didn't wait for the page to finish refreshing to the corresponding value. (unexpected)

So, if I had to guess, I think it may have something to do with the "click" routine in Watir.  Perhaps it needs to have additional wait checks in there?  ( i.e. to ensure that not only the Browser has given the 'go ahead' signal, but also that all the frames have finished loading *and* the buttons are enabled..?  I really don't know how this works, so forgive me if these suggestions are already implemented.)  I also didn't know if this is was even common to other web apps until you used the word "too".

Dunno.  If my scripts trip anywhere it's always right after a click event.  That's where I insert these little sleep lines.

I haven't logged this as a Watir bug yet, because I can't always reproduce it.  There are some pages where it seems to happen frequently, but not always.  Let's just say that I think the 'probability' is high that it has something to do with the script not waiting around long enough after all click events.

Unfortunately, I'm still trying to complete my task to meet the business need for my scripts so I haven't been able to investigate this further.  I only offer this information now in case it is helpful for someone else to continue the investigation.  It might be a wild goose, it might be helpful.  Never can tell with intermittent bugs.

Cheers.  Paul.

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to