Module: PageMagic::Elements
- Included in:
- Element
- Defined in:
- lib/page_magic/elements.rb,
lib/page_magic/elements/types.rb,
lib/page_magic/elements/config.rb,
lib/page_magic/elements/inheritance_hooks.rb
Overview
module Elements - contains methods that add element definitions to the objects it is mixed in to
Defined Under Namespace
Modules: InheritanceHooks Classes: CONFIG_STRUCT, Config
Constant Summary collapse
- INVALID_METHOD_NAME_MSG =
'a method already exists with this method name'
- TYPES =
%i[field fieldset file_field fillable_field frame link_or_button option radio_button select table table_row text_field button link checkbox select_list radio textarea label].freeze
Instance Method Summary collapse
-
#element(*args, **capybara_options) { ... } ⇒ Object
Creates an Element definition This method is aliased to each of the names specified in TYPES Element definitions contain specifications for locating them and other sub elements.
-
#element_definitions ⇒ Hash<Symbol,ElementDefinitionBuilder>
blocks that can be used to create unique instances of Element definitions.
-
#elements(*args, **capybara_options, &block) ⇒ Object
see docs for #element.
Instance Method Details
#element(name, selector, &block) ⇒ Object #element(element_class, &block) ⇒ Object #element(name, element_class, &block) ⇒ Object #element(name, element_class, selector, &block) ⇒ Object
Creates an Element definition This method is aliased to each of the names specified in TYPES Element definitions contain specifications for locating them and other sub elements.
61 62 63 64 65 66 67 |
# File 'lib/page_magic/elements.rb', line 61 def element(*args, **, &block) define_element(*args, type: __callee__, query_class: PageMagic::Element::Query::SingleResult, **, &block) end |
#element_definitions ⇒ Hash<Symbol,ElementDefinitionBuilder>
blocks that can be used to create unique instances of PageMagic::Element definitions
83 84 85 |
# File 'lib/page_magic/elements.rb', line 83 def element_definitions @element_definitions ||= {} end |
#elements(*args, **capybara_options, &block) ⇒ Object
see docs for #element
70 71 72 73 74 75 76 |
# File 'lib/page_magic/elements.rb', line 70 def elements(*args, **, &block) define_element(*args, type: __callee__.to_s.singularize.to_sym, query_class: PageMagic::Element::Query::MultipleResults, **, &block) end |