Sha256: e8ccfdeff3523548c3ce7dfcb14a245ad407bcb910baf218276e8f6ee4647223

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

module Watir
  class InputElementCollections < ElementCollections
    def each
      @container.input_element_locator(@how, @what, element_class::INPUT_TYPES, element_class).each {|element| yield element}
    end    
  end

  class Frames < ElementCollections
    def each
      @container.locator_for(FrameLocator, @how, @what).each {|element| yield element}
    end
  end

  class Forms < ElementCollections
    def each
      @container.locator_for(FormLocator, @how, @what).each {|element| yield element}
    end    
  end
  
  class HTMLElements < ElementCollections
    def each
      @container.locator_for(ElementLocator, @how, @what).each { |element| yield element }
    end
  end

  # this class accesses the check boxes in the document as a collection
  # Normally a user would not need to create this object as it is returned by the Watir::Container#checkboxes method
  class CheckBoxes < InputElementCollections
    def element_class; CheckBox; end
  end
    
  # this class accesses the select boxes in the document as a collection
  # Normally a user would not need to create this object as it is returned by the Watir::Container#select_lists method
  class SelectLists < InputElementCollections
    def element_tag; 'SELECT'; end
  end  

  %w[Button FileField Radio TextField Hidden].each do |element|
    module_eval %Q{
      class #{element}s < InputElementCollections; end
    }
  end

  class Inses < ElementCollections
    def element_class; Ins; end
  end
  
  %w[Link Li Map Area Image Table TableRow TableCell
     Label Pre P Span Div Dl Dt Dd Strong Em Del
     Font H1 H2 H3 H4 H5 H6 Meta Ol Ul].each do |element|
    module_eval %Q{
      class #{element}s < ElementCollections; end
    }
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-2.0.4 lib/watir/collections.rb
watir-2.0.3 lib/watir/collections.rb
watir-2.0.2 lib/watir/collections.rb
watir-2.0.2.rc1 lib/watir/collections.rb