I’ve been having a lot of trouble with stuff that Javascript builds in
the DOM after the complete HTML page is returned.  I’ve tried to
counter that with extreme defensiveness.

For example, this extension to Watir::SelectList is meant to bullet-
proof SelectList#select against Javascript that’s building the options
dynamically.  It waits until the desired option is included in the
select list before trying to select it, thus:

module Watir

  class SelectList

    # Wait for option, select it, return whether selected.

    alias old_select select

    def select(text)
      Watir::Waiter::wait_until { self.includes?(text) }
      Watir::Waiter::wait_until do
        old_select(text)
        self.selected?(text)
      end
    end

  end

end

When my test executes and it tries to select, for example,
‘2009.08.03.Mon.16.09.43:Name’, it _occasionally_ causes this failure
(via RSpec):

No option with text of 2009.08.03.Mon.16.09.43:Name in this select
element
C:/test/watir_extensions.rb:93:in `select'
<snipped traceback>
91      Watir::Waiter::wait_until { self.includes?(text) }
92      Watir::Waiter::wait_until do
93        old_select(text)
94        self.selected?(text)
95      end

So one question is:  If self.includes?(text) is true, how can
old_select fail?

Another is:  How are other Watir users handling dynamically-created
HTML?

Thanks, Burdette



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to