Sha256: 0ae928f21b3ba9a5fd7a49cb5b8ec71217129cd873df8511e99ca625a7ce810f

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 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] == :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

14 entries across 14 versions & 3 rubygems

Version Path
page-object-1.1.1 lib/page-object/elements/link.rb
page_object-1.1.3 lib/page-object/elements/link.rb
page_object-1.1.2 lib/page-object/elements/link.rb
page_object-1.1.1 lib/page-object/elements/link.rb
page-object-1.1.0 lib/page-object/elements/link.rb
page-object-1.0.3 lib/page-object/elements/link.rb
meeane-page-object-0.1.11 lib/page-object/elements/link.rb
page-object-1.0.2 lib/page-object/elements/link.rb
page-object-1.0.1 lib/page-object/elements/link.rb
page-object-1.0 lib/page-object/elements/link.rb
page-object-0.9.8 lib/page-object/elements/link.rb
page-object-0.9.7 lib/page-object/elements/link.rb
page-object-0.9.6 lib/page-object/elements/link.rb
page-object-0.9.5 lib/page-object/elements/link.rb