Class: Watir::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/watir/rack/browser.rb

Overview

Reopened Watir::Browser class for working with Rack

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Browser

Will start Rack instance for Watir automatically and then invoke the original Watir::Browser#initialize method.



9
10
11
12
# File 'lib/watir/rack/browser.rb', line 9

def initialize(*args)
  Rack.boot
  _original_initialize *args
end

Instance Method Details

#goto(url)

Opens the url with the browser instance. Will add Rack.host and Rack.port to the url when path is specified.

Examples:

Go to the regular url:

browser.goto "http://google.com"

Go to the controller path:

browser.goto home_path

Parameters:

  • url (String)

    URL to be navigated to.



27
28
29
30
# File 'lib/watir/rack/browser.rb', line 27

def goto(url)
  url = "http://#{Rack.host}:#{Rack.port}#{url}" unless url =~ %r{^(about|data|https?):}i
  _original_goto url
end