I have an issue which I suspect can only be solved elegantly by getting
our dev team to make some changes to our application. I suspect that
the issue I'm having would be a general one with *any* tool attempting
to automate a browser (hence my crossposting).
The issue is that there is javascript attached to the 'next page' link.
This script takes some time to run before advancing to the next page.
Watir sensibly waits for IE to not be busy after a control is clicked,
however, because the script is running, it looks like IE is not busy.
As a result, the script clicks on the link, then immediately checks for
the elements on the next page. They're not there, but Watir is tricked
into progressing because IE is not loading a page.
You can see the issue by running the script below. I naively assumed
that my script would click the link to proceed then wait until the next
page had loaded.
My question is, is this a problem that is encountered frequently? I can
imagine a few solutions -
- Have the javascript set some visible state indicator on the webpage so
that my script can wait for the state indicator to change.
- Similarly, just poll until the next page appears to be loaded, or
- Have the javascript somehow put IE into a busy/loading state
immediately. Does anyone know if this is possible?
- Add a wait into my script, or into the click method of links (which is
my current hack).
Would love to hear suggestions. It seems an interesting problem, and I
am sure someone else must have encountered something similar (in Watir
or some other automation effort).
I also don't think this is something that we might reasonably expect
Watir to handle automatically, but am happy to be corrected.
Jared
require 'Watir'
include Watir
$ie=IE.new
$ie.methods
$ie.goto("http://www.quinert.com/test.html")
$ie.link(:text,"First").click
$ie.link(:text,"Second").click
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general