Method: PageMagic::Element::Selector#build

Defined in:
lib/page_magic/element/selector.rb

#build(element_type, locator, options: {}) ⇒ Object

Build selector query parameters for Capybara's find method

Parameters:

  • element_type (Symbol)

    the type of browser element being found. e.g :link

  • locator (Hash<Symbol,String>)

    the selection method and its parameter. E.g. text: 'click me'



50
51
52
53
# File 'lib/page_magic/element/selector.rb', line 50

def build(element_type, locator, options: {})
  array = [type(element_type), selector, formatter.call(locator)].compact
  Model.new(array, self.options.merge(options))
end