Class: Insite::UndefinedPage
- Inherits:
-
Object
- Object
- Insite::UndefinedPage
- Extended by:
- ComponentMethods
- Includes:
- CommonMethods, ComponentInstanceMethods
- Defined in:
- lib/insite/page/undefined_page.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#has_fragment ⇒ Object
readonly
Returns the value of attribute has_fragment.
-
#page_attributes ⇒ Object
readonly
Returns the value of attribute page_attributes.
-
#page_elements ⇒ Object
(also: #component_elements)
readonly
Returns an empty Array (since the page hasn’t been defined.).
-
#page_features ⇒ Object
readonly
Returns the value of attribute page_features.
-
#page_url ⇒ Object
readonly
Returns the value of attribute page_url.
-
#query_arguments ⇒ Object
readonly
Returns the value of attribute query_arguments.
-
#required_arguments ⇒ Object
readonly
Returns the value of attribute required_arguments.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#url_matcher ⇒ Object
readonly
Returns the value of attribute url_matcher.
-
#url_template ⇒ Object
readonly
Returns the value of attribute url_template.
Instance Method Summary collapse
-
#defined? ⇒ Boolean
Always returns false.
- #describe ⇒ Object
- #driver ⇒ Object
- #html ⇒ Object
-
#initialize(site) ⇒ UndefinedPage
constructor
A new instance of UndefinedPage.
-
#method_missing(mth, *args, &block) ⇒ Object
TODO: Do the same cache check that’s done for a defined page and reapply the method if the cache is updated and the new page DOES respond to the method.
-
#nokogiri ⇒ Object
Returns a Nokogiri object for the page HTML.
-
#on_page? ⇒ Boolean
Similar to the method that you can call on a page object you’ve defined (but always returns false since the Undefined page class is only returned when the current page doesn’t match up to any page that you’ve actually defined..
-
#title ⇒ Object
Returns the page title displayed by the browser.
-
#url ⇒ Object
Returns the current URL.
Methods included from CommonMethods
#document, #inspect, #update_object
Constructor Details
#initialize(site) ⇒ UndefinedPage
Returns a new instance of UndefinedPage.
44 45 46 47 48 |
# File 'lib/insite/page/undefined_page.rb', line 44 def initialize(site) @site = site @browser = process_browser @url = @site.browser.url end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mth, *args, &block) ⇒ Object
TODO: Do the same cache check that’s done for a defined page and reapply the method if the cache is updated and the new page DOES respond to the method.
52 53 54 55 |
# File 'lib/insite/page/undefined_page.rb', line 52 def method_missing(mth, *args, &block) raise NoMethodError, "Could not apply #{mth}. The current page could not be " \ "recognized. Current URL #{@browser.url}" end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def arguments @arguments end |
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def browser @browser end |
#has_fragment ⇒ Object (readonly)
Returns the value of attribute has_fragment.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def has_fragment @has_fragment end |
#page_attributes ⇒ Object (readonly)
Returns the value of attribute page_attributes.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def page_attributes @page_attributes end |
#page_elements ⇒ Object (readonly) Also known as: component_elements
Returns an empty Array (since the page hasn’t been defined.)
70 71 72 |
# File 'lib/insite/page/undefined_page.rb', line 70 def page_elements @page_elements end |
#page_features ⇒ Object (readonly)
Returns the value of attribute page_features.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def page_features @page_features end |
#page_url ⇒ Object (readonly)
Returns the value of attribute page_url.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def page_url @page_url end |
#query_arguments ⇒ Object (readonly)
Returns the value of attribute query_arguments.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def query_arguments @query_arguments end |
#required_arguments ⇒ Object (readonly)
Returns the value of attribute required_arguments.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def required_arguments @required_arguments end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def site @site end |
#url_matcher ⇒ Object (readonly)
Returns the value of attribute url_matcher.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def url_matcher @url_matcher end |
#url_template ⇒ Object (readonly)
Returns the value of attribute url_template.
3 4 5 |
# File 'lib/insite/page/undefined_page.rb', line 3 def url_template @url_template end |
Instance Method Details
#defined? ⇒ Boolean
Always returns false.
11 12 13 |
# File 'lib/insite/page/undefined_page.rb', line 11 def defined? false end |
#describe ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/insite/page/undefined_page.rb', line 15 def describe puts <<-EOF Page Class:\t#{name} (#{__FILE__}) URL Template:\tNA URL Matcher:\tNA Page class for any page that hasn't been defined (or that Insite doesn't recognize.) Note: If there is a page class that is defined for this page that isn't getting loaded, try the following: - Review the pages URL template for problems. A URL template is *not* an interpolated string -- it just looks like one. See the documentation for more details. - If the URL template seems to be designed correctly for loading the page, but the page's URL changes after the load, you will need to look at adding a URL matcher, which overrides the URL template for purposes of checking whether the page object is matching the currently displayed page after it has been loaded. Page Elements:\tNA EOF end |
#driver ⇒ Object
36 37 38 |
# File 'lib/insite/page/undefined_page.rb', line 36 def driver @browser.driver end |
#html ⇒ Object
40 41 42 |
# File 'lib/insite/page/undefined_page.rb', line 40 def html @browser.html end |
#nokogiri ⇒ Object
Returns a Nokogiri object for the page HTML.
58 59 60 |
# File 'lib/insite/page/undefined_page.rb', line 58 def nokogiri @site.nokogiri end |
#on_page? ⇒ Boolean
Similar to the method that you can call on a page object you’ve defined (but always returns false since the Undefined page class is only returned when the current page doesn’t match up to any page that you’ve actually defined.
65 66 67 |
# File 'lib/insite/page/undefined_page.rb', line 65 def on_page? false end |
#title ⇒ Object
Returns the page title displayed by the browser.
81 82 83 |
# File 'lib/insite/page/undefined_page.rb', line 81 def title @browser.title end |
#url ⇒ Object
Returns the current URL.
76 77 78 |
# File 'lib/insite/page/undefined_page.rb', line 76 def url @browser.url end |