Class: PageObject::IndexedProperties::TableOfElements

Inherits:
Object
  • Object
show all
Includes:
PageObject, LoadsPlatform
Defined in:
lib/page-object/indexed_properties.rb

Constant Summary

Constants included from PageObject

VERSION

Instance Attribute Summary

Attributes included from PageObject

#browser, #platform

Instance Method Summary collapse

Methods included from LoadsPlatform

#load_platform

Methods included from PageObject

add_framework, #alert, #attach_to_window, #back, #clear_cookies, #confirm, #current_url, default_element_wait, default_element_wait=, default_page_wait, default_page_wait=, #element_with_focus, #execute_script, #forward, #html, #in_frame, #in_iframe, included, #initialize_browser, javascript_framework=, #modal_dialog, #navigate_to, #prompt, #refresh, register_widget, #save_screenshot, #testModif, #text, #title, #wait_for_ajax, #wait_until

Methods included from PagePopulator

#populate_page_with

Methods included from ElementLocators

#element, included

Constructor Details

#initialize(browser, identifier_list) ⇒ TableOfElements

Returns a new instance of TableOfElements.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/page-object/indexed_properties.rb', line 7

def initialize (browser, identifier_list)
  initialize_browser(browser)
  @identifier_list = identifier_list
  @indexed_property_class = Class.new {
    include PageObject
    include LoadsPlatform
    extend Accessors

    def initialize (browser, index, identifier_list)
      initialize_browser(browser)

      identifier_list.each do |identifier|
        type = identifier[0]
        name = identifier[1]
        how_and_what = identifier[2].clone # Cannot modify the original...
        how_and_what.each do |key, value|
          how_and_what[key] = value % index
        end
        self.class.send type, name, how_and_what unless self.class.instance_methods.include? name
      end
    end
  }
end

Instance Method Details

#[](index) ⇒ Object



31
32
33
# File 'lib/page-object/indexed_properties.rb', line 31

def [] (index)
  @indexed_property_class.new(@browser,index,@identifier_list)
end