Sha256: dec5d71259f41f6246477596f31b575b65bc363b7a938ee7e263ec46fd91714e

Contents?: true

Size: 916 Bytes

Versions: 2

Compression:

Stored size: 916 Bytes

Contents

module PageObject
  module Platforms
    module Selenium
      module SelectList

        #
        # Return the PageObject::Elements::Option for the index provided.  Index
        # is zero based.
        #
        # @return [PageObject::Elements::Option]
        #
        def [](idx)
          options[idx]
        end
        
        #
        # Select a value from the list
        #
        def select(value)
          @element.send_keys(value)
        end

        #
        # Return an array of Options contained in the select lit.
        #
        # @return [array of PageObject::Elements::Option]
        def options
          options = @element.find_elements(:xpath, child_xpath)
          elements = []
          options.each do |opt|
            elements << Object::PageObject::Elements::Option.new(opt, :platform => :selenium)
          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/selenium/select_list.rb
page-object-0.2.4 lib/page-object/platforms/selenium/select_list.rb