Sha256: ebbdd566e1b6d0908a00b61ef9dcb13eabb758478cd6b23e750694ffda4703f4

Contents?: true

Size: 834 Bytes

Versions: 14

Compression:

Stored size: 834 Bytes

Contents

module AppPrism
  module Elements
    class ElementsCollection
      include Enumerable

      def initialize(identifiers, element_or_driver)
        if identifiers.keys.include?(:android) || identifiers.keys.include?(:ios)
          @locator = identifiers[:android] if android?
          @locator = identifiers[:ios] if ios?
        else
          @locator = identifiers
        end

        @element_or_driver = element_or_driver
        @sel_elements  = @element_or_driver.find_elements(@locator) #maybe allow it to be empty if elements are not visible yet
        @elements = @sel_elements.map do |elt|
          AppPrism::Elements::Element.new(elt, @element_or_driver)
        end
      end

      def each(&block)
        @elements.each(&block)
      end

      def [](index)
        @elements[index]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
app_prism-0.1.2 lib/app_prism/elements/elements_collection.rb
app_prism-0.1.1 lib/app_prism/elements/elements_collection.rb
app_prism-0.1.0 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.12 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.11 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.10 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.9 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.8 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.7 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.6 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.5 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.4 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.3 lib/app_prism/elements/elements_collection.rb
app_prism-0.0.2 lib/app_prism/elements/elements_collection.rb