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.



77
78
79
80
81
# File 'lib/chemlab/runtime/browser.rb', line 77

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.



73
74
75
# File 'lib/chemlab/runtime/browser.rb', line 73

def engine
  @engine
end

Instance Method Details

#save_screenshot(file_name) ⇒ Object



83
84
85
# File 'lib/chemlab/runtime/browser.rb', line 83

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

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



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

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

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



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

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