Sha256: a5075af43947dcf822fda7e70f759be70479437de337ae4df0ad398c24df455b

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

module PageObject
  module Elements
    class Link < Element

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

      protected

      def self.watir_finders
        super + [:href, :text, :css, :title]
      end

      def self.watir_mapping
        super.merge({:link => :text, :link_text => :text})
      end

      def self.selenium_finders
        super + [:link, :link_text, :title]
      end

      def self.selenium_mapping
        super.merge(:text => :link_text)
      end

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

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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