Class: Chemlab::Runtime::Browser::Session

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

Overview

An individual session

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser) ⇒ Session

Returns a new instance of Session.



85
86
87
88
89
# File 'lib/chemlab/runtime/browser.rb', line 85

def initialize(browser)
  @engine = Watir::Browser.new(*browser)

  # @engine.goto(Chemlab.configuration.base_url)
end

Instance Attribute Details

#engineObject (readonly)

Returns the value of attribute engine.



81
82
83
# File 'lib/chemlab/runtime/browser.rb', line 81

def engine
  @engine
end

Instance Method Details

#save_screenshot(file_name) ⇒ Object



91
92
93
# File 'lib/chemlab/runtime/browser.rb', line 91

def save_screenshot(file_name)
  engine.screenshot.save(file_name)
end

#wait_until(timeout, message = nil, &block) ⇒ Object



95
96
97
# File 'lib/chemlab/runtime/browser.rb', line 95

def wait_until(timeout, message = nil, &block)
  engine.wait_until(timeout: timeout, message: message, &block)
end

#wait_while(timeout, message = nil, &block) ⇒ Object



99
100
101
# File 'lib/chemlab/runtime/browser.rb', line 99

def wait_while(timeout, message = nil, &block)
  engine.wait_while(timeout: timeout, message: message, &block)
end