Module: Site

Defined in:
lib/browser.rb

Class Method Summary collapse

Class Method Details

.browser(params = {}, &blk) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/browser.rb', line 9

def self.browser(params={}, &blk)
  params[:browser] ||= ''
  p params.inspect
  raise ArgumentError unless Constants::ALLOWED_BROWSERS.include?(params[:browser].to_sym)

  @browser = Watir::Browser.new params[:browser].to_sym

  if block_given?
    yield @browser
  else
    return @browser
  end
end