Steve wrote:
> while not ($browser.link(:text,"Withdraw").exists?)
> sleep 1
> $browser.reload()
> end
>
1.) Is there a better way for me to do this?
I am not sure why you are getting the text of old screen.
This question reminds me of a similar problem that I encountered a while
back.
One of my early scripts had this problem on one particular page of an
application I was trying to navigate. When I would click a "node" in a tree
structure, the corresponding information pane was supposed to update.
However, the ruby scripts moved too fast and the script kept returning a
similar error - i.e. it found the text from the previous page, not the
new/next page that I wanted.
In the end, I got around this by telling the script to not only wait for
what I wanted *to exist* but also to wait until what *used to be there*
*doesn't exist*. The code looked like this:
sleep 1 until $ie.span(:id, /NodeIdLabel/).exists? and $ie.span(:id,
/NodeIdLabel/).text != '.'
For the major application that I've been using Watir to test, I need to tell
the scripts to specifically wait for all of the frames to finish loading. I
use the "wait" function on each frame for that.
This one application was different because it didn't have frames like that.
That is, "ie.show_frames" returned that "there are 0 frames". The "exists?"
part of the command above was important too because sometimes the script
would hit the page again when it was in the middle of refreshing and it
would break because there was *nothing* on the page to return.
Steve, if you don't have frames that you can apply the "wait" method to,
perhaps you can try something similar that worked for me? That is, tell the
script to wait until what's currently there to go away *and* the link you
want to exist.
Just a thought. Good luck.
Paul C.
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general