I can't get Bret's code to work either.
I tried all classes and Watir::Element is not included

My Code:

require 'Watir'

def is_element_subclass? klass
  while klass = klass.superclass
  return true
end
end
ObjectSpace.each_object(Class){|c| puts c if is_element_subclass?(c)}


Cheers,
Alister



On Sep 29, 7:26 pm, Željko Filipin <zeljko.fili...@wa-research.ch>
wrote:
> On Mon, Sep 28, 2009 at 6:08 PM, Bret Pettichord <bpettich...@gmail.com>
> wrote:
>
> > >> def is_element_subclass? klass
> > >> while klass = klass.superclass
> > >> return true if klass == Watir::Element
> > >> end
> > >> end
>
> > >> ObjectSpace.each_object(Class){|c| puts c if is_element_subclass?(c)}
>
> I executed this code on Mac and Windows and got this error message:
>
> NameError: uninitialized constant Watir::Element
>         from (irb):5:in `is_element_subclass?'
>         from (irb):9
>         from (irb):9:in `each_object'
>         from (irb):9
>
> I tried with or without `require "watir"` as the first line.
>
> What am I doing wrong?
>
> Mac:
> ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0])
> commonwatir (1.6.2)
> firewatir (1.6.2)
> safariwatir (0.3.3)
>
> Windows:
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
> commonwatir (1.6.2)
> firewatir (1.6.2)
> watir (1.6.2)
>
> Željko
--~--~---------~--~----~------------~-------~--~----~
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