Sha256: c0ba086515a5efe290e33c232e51baedaaaf5c69f4d677ccd758cb5df7d7b35b

Contents?: true

Size: 959 Bytes

Versions: 2

Compression:

Stored size: 959 Bytes

Contents

module PageObject
  module Platforms
    module Watir
      module SelectList

        #
        # Return the PageObject::Elements::Option for the index provided.  Index
        # is zero based.
        #
        # @return [PageObject::Elements::Option]
        #
        def [](idx)
          PageObject::Elements::Option.new(options[idx], :platform => :watir)
        end

        #
        # Select a value from the list
        #
        def select(value)
          @element.select(value)
        end

        #
        # Return an array of Options contained in the select lit.
        #
        # @return [array of PageObject::Elements::Option]
        #
        def options
          elements = []
          options = @element.wd.find_elements(:xpath, child_xpath)
          options.each do |opt|
            elements << PageObject::Elements::Option.new(opt, :platform => :watir)
          end
          elements
        end
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page-object-0.2.5 lib/page-object/platforms/watir/select_list.rb
page-object-0.2.4 lib/page-object/platforms/watir/select_list.rb