Sha256: 9ef12b7d5e0a1d29276bf228900be5f8ef5fc0836bddbb7c42fc004eef300f7b

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 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[Buttons FileFields Radios TextFields Hiddens].each do |collection|
    module_eval %Q{
      class #{collection} < InputElementCollections; end
    }
  end
  
  %w[Links Lis Maps Areas Images Tables TableRows TableCells
     Labels Pres Ps Spans Divs Dls Dts Dds Strongs Ems].each do |collection|
    module_eval %Q{
      class #{collection} < ElementCollections; end
    }
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-2.0.1 lib/watir/collections.rb
watir-2.0.0 lib/watir/collections.rb
watir-2.0.0.rc3 lib/watir/collections.rb