Class: PageObject::Elements::Table

Inherits:
Element
  • Object
show all
Includes:
Enumerable
Defined in:
lib/page-object/elements/table.rb

Instance Attribute Summary

Attributes inherited from Element

#element

Instance Method Summary collapse

Methods inherited from Element

#click, #disabled?, #double_click, #enabled?, #inspect, #method_missing, selenium_identifier_for, #style, watir_identifier_for

Methods included from NestedElements

#button_element, #button_elements, #cell_element, #cell_elements, #checkbox_element, #checkbox_elements, #div_element, #div_elements, #file_field_element, #form_element, #form_elements, #h1_element, #h1_elements, #h2_element, #h2_elements, #h3_element, #h3_elements, #h4_element, #h4_elements, #h5_element, #h5_elements, #h6_element, #h6_elements, #hidden_field_element, #hidden_field_elements, #image_element, #image_elements, #label_element, #label_elements, #link_element, #link_elements, #list_item_element, #list_item_elements, #ordered_list_element, #ordered_list_elements, #paragraph_element, #paragraph_elements, #radio_button_element, #radio_button_elements, #select_list_element, #select_list_elements, #span_element, #span_elements, #table_element, #table_elements, #text_area_element, #text_area_elements, #text_field_element, #text_field_elements, #unordered_list_element, #unordered_list_elements

Constructor Details

#initialize(element, platform) ⇒ Table

Returns a new instance of Table.



7
8
9
10
# File 'lib/page-object/elements/table.rb', line 7

def initialize(element, platform)
  @element = element
  include_platform_for platform
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject::Elements::Element

Instance Method Details

#eachPageObject::Elements::TableRow

iterator that yields with a PageObject::Elements::TableRow



17
18
19
20
21
# File 'lib/page-object/elements/table.rb', line 17

def each
  for index in 1..self.rows do
    yield self[index-1]
  end
end

#first_rowObject

return the first row

Returns:

  • PageObject::Elements::TableRow



28
29
30
# File 'lib/page-object/elements/table.rb', line 28

def first_row
  self[0]
end

#last_rowObject

return the last row

Returns:

  • PageObject::Elements::TableRow



37
38
39
# File 'lib/page-object/elements/table.rb', line 37

def last_row
  self[-1]
end