Class: PageObject::Elements::Table
- Includes:
- Enumerable
- Defined in:
- lib/page-object/elements/table.rb
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#[](what) ⇒ PageObject::Elements::TableRow
Return the PageObject::Elements::TableRow for the index provided.
-
#column_values(what) ⇒ Object
Returns the Array of values(String) in a column for the index provided.
-
#each(&block) ⇒ PageObject::Elements::TableRow
iterator that yields with a PageObject::Elements::TableRow.
-
#last_row ⇒ Object
return the last row.
-
#rows ⇒ Object
Returns the number of rows in the table.
Methods inherited from Element
#==, #check_exists, #check_visible, #children, #disabled?, #drag_and_drop_on, #following_sibling, #following_siblings, #initialize, #method_missing, #name, #parent, plural_form, #preceding_sibling, #preceding_siblings, #present?, #respond_to_missing?, #siblings, #wait_until, #when_not_present, #when_present
Methods included from NestedElements
Constructor Details
This class inherits a constructor from PageObject::Elements::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PageObject::Elements::Element
Instance Method Details
#[](what) ⇒ PageObject::Elements::TableRow
Return the PageObject::Elements::TableRow for the index provided. Index is zero based. If the index provided is a String then it will be matched with the text from any column. The text can be a substring of the full column text.
33 34 35 36 |
# File 'lib/page-object/elements/table.rb', line 33 def [](what) idx = find_index(what) idx && row_items[idx] end |
#column_values(what) ⇒ Object
Returns the Array of values(String) in a column for the index provided. Index is zero based. If the index provided is a String then it will be matched with the text from the header. The text can be a substring of the full header text.
50 51 52 53 |
# File 'lib/page-object/elements/table.rb', line 50 def column_values(what) idx = find_index_of_header(what) idx && row_items.drop(1).collect { |row| row.cell(index: idx).text } end |
#each(&block) ⇒ PageObject::Elements::TableRow
iterator that yields with a PageObject::Elements::TableRow
11 12 13 |
# File 'lib/page-object/elements/table.rb', line 11 def each(&block) row_items.each(&block) end |
#last_row ⇒ Object
return the last row
22 23 24 |
# File 'lib/page-object/elements/table.rb', line 22 def last_row self[-1] end |
#rows ⇒ Object
Returns the number of rows in the table.
41 42 43 |
# File 'lib/page-object/elements/table.rb', line 41 def rows row_items.size end |