class PageMagic::ElementContext

class ElementContext - resolves which element definition to use when accessing the browser.

Attributes

page_element[R]

Public Class Methods

new(page_element) click to toggle source
# File lib/page_magic/element_context.rb, line 8
def initialize(page_element)
  @page_element = page_element
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source

acts as proxy to element definitions defined on @page_element @return [Object] result of calling method on page_element @return [Element] page element containing located browser element @return [Array<Element>] array of elements if more that one result was found the browser

Calls superclass method
# File lib/page_magic/element_context.rb, line 16
def method_missing(method, *args, &block)
  return page_element.send(method, *args, &block) if page_element.methods.include?(method)

  builder = page_element.element_by_name(method, *args)

  super unless builder

  builder.build(page_element.browser_element)
end
respond_to_missing?(*args) click to toggle source
Calls superclass method
# File lib/page_magic/element_context.rb, line 26
def respond_to_missing?(*args)
  page_element.respond_to?(*args) || super
end