module PageObject::Accessors

Public Instance Methods

button(name, identifier={}, &block)
Alias for: single
buttons(name, identifier={})
Alias for: collection
check_box(name, identifier={}, &block)
Alias for: single
check_boxes(name, identifier={})
Alias for: collection
collection(name, identifier={}) click to toggle source
# File lib/mobpage/page_object/accessors.rb, line 38
def collection(name, identifier={})
  create_standard_methods_for_collection(name, identifier)
end
create_standard_methods(name, identifier={}, &block) click to toggle source
# File lib/mobpage/page_object/accessors.rb, line 4
def create_standard_methods(name, identifier={}, &block)
  define_method("#{name}_element") do
    if identifier.has_key?(:index)
      index = identifier[:index].to_i
      identifier.delete(:index)
      @driver.find_elements(identifier)[index]
    elsif identifier.has_key?(:text)
      elements = @driver.find_elements(identifier)
      elements.each do |element|
        return element if element.text == identifier[:text]
        nil
      end
    elsif identifier.has_key?(:name) && identifier.has_key?(:class)
      elements = @driver.find_elements(class: identifier[:class])
      elements.each do |element|
        return element if element.attribute('name').strip == identifier[:name].strip
        nil
      end
    else
      @driver.find_element(identifier)
    end
  end
end
create_standard_methods_for_collection(name, identifier={}) click to toggle source
# File lib/mobpage/page_object/accessors.rb, line 28
def create_standard_methods_for_collection(name, identifier={})
  define_method("#{name}_elements") do
    @driver.find_elements(identifier)
  end
end
dialog(name, identifier={}, &block)
Alias for: single
dialogs(name, identifier={})
Alias for: collection
element(name, identifier={}, &block)
Alias for: single
elements(name, identifier={})
Alias for: collection
image(name, identifier={}, &block)
Alias for: single
images(name, identifier={})
Alias for: collection
item_list(name, identifier={}, &block)
Alias for: single
item_lists(name, identifier={})
Alias for: collection
label(name, identifier={}, &block)
Alias for: single
labels(name, identifier={})
Alias for: collection
paragraph(name, identifier={}, &block)
Alias for: single
paragraphs(name, identifier={})
Alias for: collection
picker(name, identifier={}, &block)
Alias for: single
pickers(name, identifier={})
Alias for: collection
pin(name, identifier={}, &block)
Alias for: single
pins(name, identifier={})
Alias for: collection
radio_button(name, identifier={}, &block)
Alias for: single
radio_buttons(name, identifier={})
Alias for: collection
select_list(name, identifier={}, &block)
Alias for: single
select_lists(name, identifier={})
Alias for: collection
single(name, identifier={}, &block) click to toggle source
# File lib/mobpage/page_object/accessors.rb, line 34
def single(name, identifier={}, &block)
  create_standard_methods(name, identifier)
end
spinner(name, identifier={}, &block)
Alias for: single
spinners(name, identifier={})
Alias for: collection
switch(name, identifier={}, &block)
Alias for: single
switches(name, identifier={})
Alias for: collection
text_field(name, identifier={}, &block)
Alias for: single
text_fields(name, identifier={})
Alias for: collection
view_switcher(name, identifier={}, &block)
Alias for: single
view_switchers(name, identifier={})
Alias for: collection