Class: Chemlab::Page
- Defined in:
- lib/chemlab/page.rb,
lib/chemlab/cli/stubber.rb
Overview
For each page that extends Chemlab::Page, run the stubber
Class Method Summary collapse
Instance Method Summary collapse
-
#on_page? ⇒ Boolean
Check that the current Path segment of the URL matches the Path of the page.
-
#visit ⇒ Object
Visit the given page, specified by path ‘/the_path’.
Methods inherited from Component
perform, public_elements, #visible?
Class Method Details
.inherited(subclass) ⇒ Object
31 32 33 34 35 |
# File 'lib/chemlab/cli/stubber.rb', line 31 def self.inherited(subclass) print subclass Stubber.libraries << subclass end |
Instance Method Details
#on_page? ⇒ Boolean
Check that the current Path segment of the URL matches the Path of the page
24 25 26 27 28 29 |
# File 'lib/chemlab/page.rb', line 24 def on_page? URI(Chemlab.configuration.browser.url).path&.match?(self.class.path) rescue TypeError # it's likely there is no path because of the page using the data protocol e.g.: "data:," false end |
#visit ⇒ Object
Visit the given page, specified by path ‘/the_path’
9 10 11 |
# File 'lib/chemlab/page.rb', line 9 def visit Runtime::Browser.navigate_to(self.class) end |