Class: Pages::BasePage

Inherits:
Object
  • Object
show all
Includes:
PageHelper
Defined in:
lib/watir_setup/base_page.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PageHelper

#on

Constructor Details

#initialize(browser) ⇒ BasePage

Returns a new instance of BasePage.



5
6
7
# File 'lib/watir_setup/base_page.rb', line 5

def initialize(browser)
  @browser = browser
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



19
20
21
# File 'lib/watir_setup/base_page.rb', line 19

def method_missing(sym, *args, &block)
  @browser.send(sym, *args, &block)
end

Class Method Details

.url(url) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/watir_setup/base_page.rb', line 9

def self.url(url)
  define_method("url") do
    if url.is_a?(Hash)
      build_url(url)
    else
      url
    end
  end
end

Instance Method Details

#gotoObject



23
24
25
26
# File 'lib/watir_setup/base_page.rb', line 23

def goto
  @browser.goto(self.url)
  self
end