Class: CapybaraPageObject::TableRowElement
- Includes:
- Enumerable
- Defined in:
- lib/capybara_page_object/elements/table_row_element.rb
Instance Attribute Summary collapse
-
#parent_table ⇒ Object
readonly
Returns the value of attribute parent_table.
Attributes inherited from Element
Instance Method Summary collapse
- #[](column_index) ⇒ Object
- #columns ⇒ Object
- #each ⇒ Object
-
#initialize(element, page, parent_table = nil) ⇒ TableRowElement
constructor
A new instance of TableRowElement.
Methods inherited from Element
#attribute, #class, #enabled?, #focus, #html, #method_missing, #native, #parent, #respond_to_missing?, #scroll_into_view, #within
Constructor Details
#initialize(element, page, parent_table = nil) ⇒ TableRowElement
Returns a new instance of TableRowElement.
7 8 9 10 |
# File 'lib/capybara_page_object/elements/table_row_element.rb', line 7 def initialize(element, page, parent_table = nil) super(element, page) @parent_table = parent_table || find_parent_table end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CapybaraPageObject::Element
Instance Attribute Details
#parent_table ⇒ Object (readonly)
Returns the value of attribute parent_table.
5 6 7 |
# File 'lib/capybara_page_object/elements/table_row_element.rb', line 5 def parent_table @parent_table end |
Instance Method Details
#[](column_index) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/capybara_page_object/elements/table_row_element.rb', line 18 def [](column_index) if column_index.kind_of?(String) column_index = lookup_index_by_name(column_index) end return nil if column_index == nil columns[column_index] end |
#columns ⇒ Object
27 28 29 30 31 |
# File 'lib/capybara_page_object/elements/table_row_element.rb', line 27 def columns within do all(:xpath, ".//child::td|th") end end |
#each ⇒ Object
12 13 14 15 16 |
# File 'lib/capybara_page_object/elements/table_row_element.rb', line 12 def each for index in 1..self.columns.length do yield self[index-1] end end |