Hi
   I'm testing an application that integrates with a payment gateway.
This involves about 3 redirects. Each of these is not 302's but a page
that has a form and an onload script that submits the form via
javascript.
The problem is sometimes watir continues before the chain of
redirects. So sometimes the page the browser is on when our script
continues execution is not the last page and the script throws an
error.

sometimes webdriver throws an error because references have become
stale. This is not a reference that I have saved and then used but
just something as simple as @browser.text.should include('some text')

we get errors like
    Unable to locate element: {"method":"tag name","selector":"body"}
     # [remote server]
file:///private/var/folders/W5/W5PGX-JAH0KpXOjqG8Xwg++++TM/-Tmp-/webdriver-profile20110119-41715-1iz0tqc/extensions/fxdri...@googlecode.com/resource/modules/utils.js:7081:in
`WebDriverError'

or

     Element not found in the cache
     # [remote server]
file:///private/var/folders/W5/W5PGX-JAH0KpXOjqG8Xwg++++TM/-Tmp-/webdriver-profile20110119-40433-14jajfa/extensions/fxdri...@googlecode.com/resource/modules/utils.js:7081:in
`WebDriverError'
     # [remote server]
file:///private/var/folders/W5/W5PGX-JAH0KpXOjqG8Xwg++++TM/-Tmp-/webdriver-profile20110119-40433-14jajfa/extensions/fxdri...@googlecode.com/resource/modules/utils.js:7198:in
`'


I posted an issue on github and jarib suggested I use something like
wait_until_present to make sure I'm on the page I expect to be. But I
have 2 concerns.
firstly, even with wait_until_present is there a likelyhood I get a
stale reference error?
secondly, sometimes one of these redirects on the way might actually
fail and throw me onto an error page. In which case I'll have to
wait_until_present with a timeout. I'd prefer a more deterministic
approach. Is there a way for me to get watir to check if the current
page has completely loaded AND all onload scripts have run before
giving me control? Something I can run in a loop so that the script
continues only when all redirects are done

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to