Class: Insite::UndefinedPage

Inherits:
Object
  • Object
show all
Extended by:
ComponentMethods
Includes:
CommonMethods, ComponentInstanceMethods
Defined in:
lib/insite/page/undefined_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonMethods

#document, #process_browser, #update_object

Constructor Details

#initialize(site) ⇒ UndefinedPage

Returns a new instance of UndefinedPage.



23
24
25
26
27
# File 'lib/insite/page/undefined_page.rb', line 23

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.

Raises:

  • (NoMethodError)


31
32
33
34
# File 'lib/insite/page/undefined_page.rb', line 31

def method_missing(mth, *args, &block)
  raise NoMethodError, "Could not apply #{mth}. The current page couldn't " \
  "be recognized. Current URL #{@browser.url}"
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



3
4
5
# File 'lib/insite/page/undefined_page.rb', line 3

def arguments
  @arguments
end

#browserObject (readonly)

Returns the value of attribute browser.



3
4
5
# File 'lib/insite/page/undefined_page.rb', line 3

def browser
  @browser
end

#has_fragmentObject (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_attributesObject (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_elementsObject (readonly) Also known as: component_elements

Returns an empty Array (since the page hasn’t been defined.)



49
50
51
# File 'lib/insite/page/undefined_page.rb', line 49

def page_elements
  @page_elements
end

#page_featuresObject (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_urlObject (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

#required_argumentsObject (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

#siteObject (readonly)

Returns the value of attribute site.



3
4
5
# File 'lib/insite/page/undefined_page.rb', line 3

def site
  @site
end

#url_matcherObject (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_templateObject (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.

Returns:

  • (Boolean)


11
12
13
# File 'lib/insite/page/undefined_page.rb', line 11

def defined?
  false
end

#driverObject



15
16
17
# File 'lib/insite/page/undefined_page.rb', line 15

def driver
  @browser.driver
end

#htmlObject



19
20
21
# File 'lib/insite/page/undefined_page.rb', line 19

def html
  @browser.html
end

#nokogiriObject

Returns a Nokogiri object for the page HTML.



37
38
39
# File 'lib/insite/page/undefined_page.rb', line 37

def nokogiri
  Nokogiri::HTML(html)
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.

Returns:

  • (Boolean)


44
45
46
# File 'lib/insite/page/undefined_page.rb', line 44

def on_page?
  false
end

#titleObject

Returns the page title displayed by the browser.



60
61
62
# File 'lib/insite/page/undefined_page.rb', line 60

def title
  @browser.title
end

#urlObject

Returns the current URL.



55
56
57
# File 'lib/insite/page/undefined_page.rb', line 55

def url
  @browser.url
end