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.



41
42
43
44
45
# File 'lib/chemlab/runtime/browser.rb', line 41

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.



37
38
39
# File 'lib/chemlab/runtime/browser.rb', line 37

def engine
  @engine
end

Instance Method Details

#save_screenshot(file_name) ⇒ Object



47
48
49
# File 'lib/chemlab/runtime/browser.rb', line 47

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

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



51
52
53
# File 'lib/chemlab/runtime/browser.rb', line 51

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

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



55
56
57
# File 'lib/chemlab/runtime/browser.rb', line 55

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