Class: Chemlab::Runtime::Browser::Session
- Inherits:
-
Object
- Object
- Chemlab::Runtime::Browser::Session
- Extended by:
- Forwardable
- 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
-
#initialize(browser) ⇒ Session
constructor
A new instance of Session.
- #save_screenshot(file_name) ⇒ Object
- #wait_until(timeout, message = nil, &block) ⇒ Object
- #wait_while(timeout, message = nil, &block) ⇒ Object
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
#engine ⇒ Object (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, = nil, &block) engine.wait_until(timeout: timeout, 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, = nil, &block) engine.wait_while(timeout: timeout, message: , &block) end |