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

Inherits:
Object
  • Object
show all
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.



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

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.



28
29
30
# File 'lib/chemlab/runtime/browser.rb', line 28

def engine
  @engine
end

Instance Method Details

#current_urlObject



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

def current_url
  engine.url
end

#quitObject



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

def quit
  engine.close
end

#refreshObject



40
41
42
# File 'lib/chemlab/runtime/browser.rb', line 40

def refresh
  engine.refresh
end

#save_screenshot(file_name) ⇒ Object



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

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

#textObject



44
45
46
# File 'lib/chemlab/runtime/browser.rb', line 44

def text
  engine.text
end

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



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

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

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



60
61
62
# File 'lib/chemlab/runtime/browser.rb', line 60

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