Sha256: cf44abd90d8d6d0dc62080801d7f4a775297ac608e6398ff5785cf8f2dbc1d78

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

module PageObject
  module Elements
    class SelectList < Element

      def initialize(element, platform)
        @element = element
        include_platform_for platform
      end

      protected

      def child_xpath
        ".//child::option"
      end

      def self.watir_finders
        super + [:text, :value, :label]
      end

      def self.selenium_finders
        super + [:label]
      end

      def include_platform_for platform
        super
        if platform[:platform] == :watir_webdriver
          require 'page-object/platforms/watir_webdriver/select_list'
          self.class.send :include, PageObject::Platforms::WatirWebDriver::SelectList
        elsif platform[:platform] == :lds_watir_webdriver
          require 'page-object/platforms/lds_watir_webdriver/select_list'
          self.class.send :include, PageObject::Platforms::LdsWatirWebDriver::SelectList
        elsif platform[:platform] == :selenium_webdriver
          require 'page-object/platforms/selenium_webdriver/select_list'
          self.class.send :include, PageObject::Platforms::SeleniumWebDriver::SelectList
        else
          raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
        end
      end

    end

    ::PageObject::Elements.tag_to_class[:select] = ::PageObject::Elements::SelectList
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page-object-lds-0.0.14 lib/page-object/elements/select_list.rb
page-object-lds-0.0.13 lib/page-object/elements/select_list.rb
page-object-lds-0.0.12 lib/page-object/elements/select_list.rb
page-object-lds-0.0.11 lib/page-object/elements/select_list.rb
page-object-lds-0.0.1 lib/page-object/elements/select_list.rb