Sha256: 3619e9e8f26a89e2e8a45f674eb20af88d3bd5c44893eb9c5a8efabd6638079a

Contents?: true

Size: 1.67 KB

Versions: 8

Compression:

Stored size: 1.67 KB

Contents

module Fluent
  module Platforms
    module WatirWebDriver
      module SelectList
        
        def select(value)
          web_element.select(value)
        end

        def select_value(value)
          web_element.select_value(value)
        end

        def selected?(value)
          web_element.selected? value
        end
        
        # @return [Array] array of strings representing the text of the currently selected options
        def selected_options
          web_element.selected_options.map { |e| e.text }.compact
        end

        # @return [Array] array of strings representing the value of the currently selected options
        def selected_values
          web_element.selected_options.map { |e| e.value }.compact
        end

        def include?(value)
          web_element.include? value
        end
        
        # Returns an object representing the option for the index provided.
        # The index is zero-based.
        #
        # @return [Object] Fluent::WebElements::Option
        def [](index)
          ::Fluent::WebElements::Option.new(options[index], :platform => :watir_webdriver)
        end
        
        # Provides an array of Option objects that are contained within
        # a select list object.
        #
        # @return [Array] Fluent::WebElements::Option objects
        def options
          elements = []
          options = web_element.wd.find_elements(:xpath, option_xpath)
          options.each do |option|
            elements << ::Fluent::WebElements::Option.new(option, :platform => :watir_webdriver)
          end
          elements
        end
        
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fluent-0.7.2 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.7.1 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.7.0 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.6.0 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.5.0 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.4.0 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.3.0 lib/fluent/platform_watir/platform_web_elements/select_list.rb
fluent-0.2.0 lib/fluent/platform_watir/platform_web_elements/select_list.rb