Module: PageObject::Widgets

Defined in:
lib/page-object/widgets.rb

Class Method Summary collapse

Class Method Details

.register_widget(widget_tag, widget_class, base_element_tag) ⇒ Object

Module that allows for the registration of widget classes which extend the functionality of PageObject Allows any classes which extend PageObject::Element to be used as PageObject elements. This allows such widgets to be created using the defined tags.

Parameters:

  • defines (Symbol)

    the symbol which will be used as an accessor name.

  • the (Class)

    widget class extending PageObject::Elements::Element

  • the (Symbol)

    symbol of the html element used when searching for this widget.



17
18
19
20
21
22
23
24
25
# File 'lib/page-object/widgets.rb', line 17

def self.register_widget(widget_tag, widget_class, base_element_tag)
  if widget_class.ancestors.include? Elements::Element
    define_accessors(Accessors, widget_tag, widget_class)
    define_nested_elements(Elements::Element, widget_tag)
    define_locators(PageObject, widget_tag)

    PageObject::Platforms::Watir::PageObject.define_widget_accessors(widget_tag, widget_class, base_element_tag)
  end
end