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}(:[EMAIL PROTECTED], [EMAIL PROTECTED])" if n > 0

                                                                        return

                                                            end

                                                end

                                                sleep 1

                                    end

                                    raise ("#{self.class}(:[EMAIL PROTECTED], [EMAIL PROTECTED]) not found after #{how_long} sec") if ! exists?

                                    raise ("#{self.class}(:[EMAIL PROTECTED], [EMAIL PROTECTED]) not enabled after #{how_long} sec")

                        end

            end

end

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

Reply via email to