Method: PageObject#initialize

Defined in:
lib/page-object.rb

#initialize(root, visit = false) ⇒ Object

Construct a new page object. Prior to browser initialization it will call a method named initialize_accessors if it exists. Upon initialization of the page it will call a method named initialize_page if it exists.

Parameters:

  • the (Watir::Browser, Watir::HTMLElement or Selenium::WebDriver::Driver, Selenium::WebDriver::Element)

    platform browser/element to use

  • open (bool)

    the page if page_url is set



73
74
75
76
77
78
# File 'lib/page-object.rb', line 73

def initialize(root, visit=false)
  initialize_accessors if respond_to?(:initialize_accessors)
  initialize_browser(root)
  goto if visit && self.class.instance_methods(false).include?(:goto)
  initialize_page if respond_to?(:initialize_page)
end