module PageMagic::Element::Locators

contains method for finding element definitions

Constants

ELEMENT_NOT_DEFINED_MSG

message used when raising {ElementMissingException} from methods within this module

Public Instance Methods

element_by_name(name, *args) click to toggle source

find an element definition based on its name @param [Symbol] name name of the element @return [Element] element definition with the given name @raise [ElementMissingException] raised when element with the given name is not found

# File lib/page_magic/element/locators.rb, line 15
def element_by_name(name, *args)
  definition = element_definitions[name]
  raise ElementMissingException, (ELEMENT_NOT_DEFINED_MSG % name) unless definition

  definition.call(self, *args)
end
element_definitions() click to toggle source

@return [Array<Element>] class level defined element definitions

# File lib/page_magic/element/locators.rb, line 23
def element_definitions
  self.class.element_definitions
end