Module: PageObject::Platforms::Watir

Defined in:
lib/page-object/platforms/watir.rb,
lib/page-object/platforms/watir/page_object.rb

Defined Under Namespace

Classes: PageObject

Class Method Summary collapse

Class Method Details

.browser_for(root) ⇒ Object


15
16
17
18
19
# File 'lib/page-object/platforms/watir.rb', line 15

def self.browser_for root
  return watir_browser(root) if watir?(root)
  return selenium_browser(root) if selenium?(root)
  nil
end

.browser_root_for(browser) ⇒ Object


25
26
27
# File 'lib/page-object/platforms/watir.rb', line 25

def self.browser_root_for browser
  browser.element
end

.create_page_object(browser) ⇒ Object


5
6
7
8
# File 'lib/page-object/platforms/watir.rb', line 5

def self.create_page_object(browser)
  browser = selenium_browser(browser) unless watir?(browser)
  return Watir::PageObject.new(browser)
end

.is_for?(browser) ⇒ Boolean


10
11
12
13
# File 'lib/page-object/platforms/watir.rb', line 10

def self.is_for?(browser)
  require 'watir'
  watir?(browser) || selenium?(browser)
end

.root_element_for(root) ⇒ Object


21
22
23
# File 'lib/page-object/platforms/watir.rb', line 21

def self.root_element_for root
  Elements::Element.new(root) if is_for?(root)
end