Class: Henry::Navigator

Inherits:
Object
  • Object
show all
Defined in:
lib/henry/navigator.rb

Overview

Defines a common interface for managing bowsers.

Constant Summary collapse

DRIVERS =
{
  'INTERNET_EXPLORER' => 'ie'
}

Instance Method Summary collapse

Constructor Details

#initialize(driver) ⇒ Navigator

Returns a new instance of Navigator.



13
14
15
# File 'lib/henry/navigator.rb', line 13

def initialize(driver)
  @driver = DRIVERS[driver] || driver
end

Instance Method Details

#closeObject

Closes the curretn browser



18
19
20
# File 'lib/henry/navigator.rb', line 18

def close
  browser.close
end

Navigates the given URL

Parameters:

  • ulr (String)

    the target URL.

Returns:



26
27
28
29
30
# File 'lib/henry/navigator.rb', line 26

def navigate(url)
  browser.goto(url)

  return self 
end

#titleString

Returns the curretn browser title.

Returns:

  • (String)

    the browser title.



35
36
37
# File 'lib/henry/navigator.rb', line 35

def title
  browser.title
end