Class: Chemlab::Runtime::Browser::Session
- Inherits:
-
Object
- Object
- Chemlab::Runtime::Browser::Session
- Defined in:
- lib/chemlab/runtime/browser.rb
Overview
An individual session
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Instance Method Summary collapse
- #current_url ⇒ Object
-
#initialize(url, browser) ⇒ Session
constructor
A new instance of Session.
- #quit ⇒ Object
- #refresh ⇒ Object
- #save_screenshot(file_name) ⇒ Object
- #text ⇒ Object
- #wait_until(timeout, message = nil, &block) ⇒ Object
- #wait_while(timeout, message = nil, &block) ⇒ Object
Constructor Details
#initialize(url, browser) ⇒ Session
Returns a new instance of Session.
31 32 33 34 35 |
# File 'lib/chemlab/runtime/browser.rb', line 31 def initialize(url, browser) @engine = Watir::Browser.new(*browser) @engine.goto(Chemlab.configuration.base_url) end |
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
29 30 31 |
# File 'lib/chemlab/runtime/browser.rb', line 29 def engine @engine end |
Instance Method Details
#current_url ⇒ Object
37 38 39 |
# File 'lib/chemlab/runtime/browser.rb', line 37 def current_url engine.url end |
#quit ⇒ Object
49 50 51 |
# File 'lib/chemlab/runtime/browser.rb', line 49 def quit engine.close end |
#refresh ⇒ Object
41 42 43 |
# File 'lib/chemlab/runtime/browser.rb', line 41 def refresh engine.refresh end |
#save_screenshot(file_name) ⇒ Object
53 54 55 |
# File 'lib/chemlab/runtime/browser.rb', line 53 def save_screenshot(file_name) engine.screenshot.save(file_name) end |
#text ⇒ Object
45 46 47 |
# File 'lib/chemlab/runtime/browser.rb', line 45 def text engine.text end |
#wait_until(timeout, message = nil, &block) ⇒ Object
57 58 59 |
# File 'lib/chemlab/runtime/browser.rb', line 57 def wait_until(timeout, = nil, &block) engine.wait_until(timeout: timeout, message: , &block) end |
#wait_while(timeout, message = nil, &block) ⇒ Object
61 62 63 |
# File 'lib/chemlab/runtime/browser.rb', line 61 def wait_while(timeout, = nil, &block) engine.wait_while(timeout: timeout, message: , &block) end |