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(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(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
#engine ⇒ Object (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_url ⇒ Object
35 36 37 |
# File 'lib/chemlab/runtime/browser.rb', line 35 def current_url engine.url end |
#quit ⇒ Object
47 48 49 |
# File 'lib/chemlab/runtime/browser.rb', line 47 def quit engine.close end |
#refresh ⇒ Object
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 |
#text ⇒ Object
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, = nil, &block) engine.wait_until(timeout: timeout, 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, = nil, &block) engine.wait_while(timeout: timeout, message: , &block) end |