[wtr-general] Re: Trouble testing dynamically-created HTML

2009-08-11 Thread Burdette Lamar

I erred in asking two questions here.  I'll post the second
separately.

On Aug 5, 9:32 am, Burdette Lamar burdettela...@yahoo.com wrote:
 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
-~--~~~~--~~--~--~---



[wtr-general] Re: Trouble testing dynamically-created HTML

2009-08-11 Thread Bret Pettichord



On Aug 10, 8:28 pm, Jari Bakken jari.bak...@gmail.com wrote:
 On Tue, Aug 11, 2009 at 1:35 AM, Bret Pettichordbpettich...@gmail.com wrote:

  I just took a quick look at the Watir code (latest from trunk). I see
  an include? method but not an includes? method.

 They both exist. SelectList#includes? is aliased in camel_case.rb.

That explains it.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[wtr-general] Re: Trouble testing dynamically-created HTML

2009-08-11 Thread Bret Pettichord

My only explanation would be that the page changes (again) after the
call to includes? returns true but before you select the item.

Bret

On Aug 5, 9:32 am, Burdette Lamar burdettela...@yahoo.com wrote:
 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
-~--~~~~--~~--~--~---



[wtr-general] Re: Trouble testing dynamically-created HTML

2009-08-10 Thread Bret Pettichord

I just took a quick look at the Watir code (latest from trunk). I see
an include? method but not an includes? method.

Bret

On Aug 5, 9:32 am, Burdette Lamar burdettela...@yahoo.com wrote:
 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
-~--~~~~--~~--~--~---