Class: Chemlab::Runtime::Browser
- Inherits:
-
Object
- Object
- Chemlab::Runtime::Browser
- Extended by:
- Forwardable
- Defined in:
- lib/chemlab/runtime/browser.rb
Overview
The browser configurator
Defined Under Namespace
Classes: Session
Instance Attribute Summary collapse
-
#browser_options ⇒ Object
readonly
Returns the value of attribute browser_options.
-
#session ⇒ Object
Returns the value of attribute session.
Class Method Summary collapse
-
.navigate_to(page_class) ⇒ Object
Navigate to a given Page library.
Instance Method Summary collapse
-
#initialize(browser_options) ⇒ Browser
constructor
A new instance of Browser.
-
#navigate_to(path) ⇒ String
Navigate to a Path.
-
#to_s ⇒ Object
The options used to create the browser session.
Constructor Details
Instance Attribute Details
#browser_options ⇒ Object (readonly)
Returns the value of attribute browser_options.
12 13 14 |
# File 'lib/chemlab/runtime/browser.rb', line 12 def @browser_options end |
#session ⇒ Object
Returns the value of attribute session.
11 12 13 |
# File 'lib/chemlab/runtime/browser.rb', line 11 def session @session end |
Class Method Details
.navigate_to(page_class) ⇒ Object
Navigate to a given Page library
47 48 49 50 51 52 53 |
# File 'lib/chemlab/runtime/browser.rb', line 47 def self.navigate_to(page_class) unless page_class&.name.respond_to?(:root_module) && page_class.name.root_module.respond_to?(:base_url) return Chemlab.configuration.browser.navigate_to(Chemlab.configuration.base_url + page_class.path) end Chemlab.configuration.browser.navigate_to(File.join(page_class.name.root_module.base_url, page_class.path)) end |
Instance Method Details
#navigate_to(path) ⇒ String
Navigate to a Path
60 61 62 63 |
# File 'lib/chemlab/runtime/browser.rb', line 60 def navigate_to(path) @session ||= Chemlab.configuration.browser.session @session.engine.goto(path.to_s) end |
#to_s ⇒ Object
The options used to create the browser session
66 67 68 |
# File 'lib/chemlab/runtime/browser.rb', line 66 def to_s @browser_options.to_s end |