Sha256: c7b8a14c415de26d4f6ccba05a7313de5423f2785b2523f223877b7db62f9b81

Contents?: true

Size: 891 Bytes

Versions: 9

Compression:

Stored size: 891 Bytes

Contents

module PageObject
  module Platforms
    module SeleniumWebDriver

      def self.create_page_object(browser)
        SeleniumWebDriver::PageObject.new(browser)
      end

      def self.is_for?(browser)
        require 'selenium-webdriver'
        browser.is_a?(::Selenium::WebDriver::Driver) || browser.is_a?(::Selenium::WebDriver::Element)
      end

      def self.browser_for root
        return root if root.is_a?(::Selenium::WebDriver::Driver)
        Selenium::WebDriver::Driver.new(root.send(:bridge))
      end

      def self.root_element_for root
        Elements::Element.new root, platform: :selenium_webdriver if root.is_a?(::Selenium::WebDriver::Element)
      end

      def self.browser_root_for browser
        browser.find_element(tag_name: 'html')
      end
    end
  end
end

PageObject::Platforms.register(:selenium_webdriver, PageObject::Platforms::SeleniumWebDriver)

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
page-object-2.0.0 lib/page-object/platforms/selenium_webdriver.rb
page-object-1.2.2 lib/page-object/platforms/selenium_webdriver.rb
page-object-1.2.1 lib/page-object/platforms/selenium_webdriver.rb
page-object-1.2.0 lib/page-object/platforms/selenium_webdriver.rb
page-object-1.1.1 lib/page-object/platforms/selenium_webdriver.rb
page_object-1.1.3 lib/page-object/platforms/selenium_webdriver.rb
page_object-1.1.2 lib/page-object/platforms/selenium_webdriver.rb
page_object-1.1.1 lib/page-object/platforms/selenium_webdriver.rb
page-object-1.1.0 lib/page-object/platforms/selenium_webdriver.rb