Sha256: 440e6dde4493d5f1cf2e12bd937c25d3c6353b71861bc18d6383a72e2dcae51a

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

module PageObject
  module Elements
    class RadioButton < Element

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

      protected

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

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

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

    ::PageObject::Elements.type_to_class[:radio] = ::PageObject::Elements::RadioButton
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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