Class: Chemlab::Runtime::Browser

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/chemlab/runtime/browser.rb

Overview

The browser configurator

Defined Under Namespace

Classes: Session

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser_options) ⇒ Browser

Returns a new instance of Browser.



15
16
17
18
# File 'lib/chemlab/runtime/browser.rb', line 15

def initialize(browser_options)
  @browser_options = browser_options
  @session = Session.new(browser_options)
end

Instance Attribute Details

#browser_optionsObject (readonly)

Returns the value of attribute browser_options.



11
12
13
# File 'lib/chemlab/runtime/browser.rb', line 11

def browser_options
  @browser_options
end

#sessionObject

Returns the value of attribute session.



10
11
12
# File 'lib/chemlab/runtime/browser.rb', line 10

def session
  @session
end

Class Method Details



20
21
22
# File 'lib/chemlab/runtime/browser.rb', line 20

def self.navigate_to(page_class)
  Chemlab.configuration.browser.navigate_to(page_class.path)
end

Instance Method Details



24
25
26
27
# File 'lib/chemlab/runtime/browser.rb', line 24

def navigate_to(path)
  @session ||= Chemlab.configuration.browser.session
  @session.engine.goto(Chemlab.configuration.base_url + path)
end

#to_sObject

The options used to create the browser session



30
31
32
# File 'lib/chemlab/runtime/browser.rb', line 30

def to_s
  @browser_options.to_s
end