module MiniAutobot::PageObjects::ElementContainer
Public Instance Methods
add_to_mapped_items(item)
click to toggle source
# File lib/mini_autobot/page_objects/element_container.rb, line 22 def add_to_mapped_items(item) @mapped_items ||= [] @mapped_items << item.to_s end
element(element_name, *find_args)
click to toggle source
# File lib/mini_autobot/page_objects/element_container.rb, line 5 def element(element_name, *find_args) build element_name, *find_args do |how, what| define_method element_name.to_s do find_first(how, what) end end end
elements(collection_name, *find_args)
click to toggle source
# File lib/mini_autobot/page_objects/element_container.rb, line 13 def elements(collection_name, *find_args) build collection_name, *find_args do |how, what| define_method collection_name.to_s do find_all(how, what) end end end
Also aliased as: collection
Private Instance Methods
build(name, *find_args) { |:css, *find_args| ... }
click to toggle source
# File lib/mini_autobot/page_objects/element_container.rb, line 29 def build(name, *find_args) if find_args.empty? create_no_selector name else add_to_mapped_items name if find_args.size == 1 yield(:css, *find_args) else yield(*find_args) end end end
create_no_selector(method_name)
click to toggle source
# File lib/mini_autobot/page_objects/element_container.rb, line 42 def create_no_selector(method_name) define_method method_name do fail MiniAutobot::NoSelectorForElement.new, "#{self.class.name} => :#{method_name} needs a selector" end end