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.



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

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.



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

def engine
  @engine
end

Instance Method Details

#current_urlObject



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

def current_url
  engine.url
end

#quitObject



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

def quit
  engine.close
end

#refreshObject



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

def refresh
  engine.refresh
end

#save_screenshot(file_name) ⇒ Object



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

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

#textObject



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

def text
  engine.text
end

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



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

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

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



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

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