def to_subtype
      elem = nokogiri()
      tag_name = elem.node_name.downcase

      klass = nil

      if tag_name == "input"
        klass = case elem.get_attribute(:type)
          when *Button::VALID_TYPES
            Button
          when 'checkbox'
            CheckBox
          when 'radio'
            Radio
          when 'file'
            FileField
          else
            TextField
          end
      else
        klass = WatirNokogiri.element_class_for(tag_name)
      end

      klass.new(@parent, :element => elem)
    end
def to_subtype
      elem = nokogiri()
      tag_name = elem.node_name.downcase

      klass = nil

      if tag_name == "input"
        klass = case elem.get_attribute(:type)
          when *Button::VALID_TYPES
            Button
          when 'checkbox'
            CheckBox
          when 'radio'
            Radio
          when 'file'
            FileField
          else
            TextField
          end
      else
        klass = WatirNokogiri.element_class_for(tag_name)
      end

      klass.new(@parent, :element => elem)
    end
Cast this Element instance to a more specific subtype.

 @example
   browser.element(:xpath => "//input[@type='submit']").to_subtype
   #=> #<WatirNokogiri::Button>