[Wtr-general] [question] Setting timeout for a ie.wait method?
John Castellucci
johnc at testdev.net
Thu Jun 1 15:22:51 EDT 2006
I had a similar requirement and addressed it by adding my methods to the
Element class. This may not be the best solution, but it worked for me.
module Watir
class Element
def click_wait(how_long = 30)
wait_for(how_long)
click
end
def wait_for(how_long=30)
0.upto(how_long-1) do |n|
if exists?
if enabled?
puts
"Waited #{n} sec for #{self.class}(:#{@how}, #{@what})" if n > 0
return
end
end
sleep 1
end
raise ("#{self.class}(:#{@how},
#{@what}) not found after #{how_long} sec") if ! exists?
raise ("#{self.class}(:#{@how},
#{@what}) not enabled after #{how_long} sec")
end
end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060601/eed323e9/attachment.html
More information about the Wtr-general
mailing list