class PageObject::Elements::TableRow

Public Instance Methods

[](what) click to toggle source

Return the PageObject::Elements::TableCell 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 columns in the first row. The text can be a substring of the full column text.

# File lib/page-object/elements/table_row.rb, line 21
def [](what)
  idx = find_index(what)
  idx && cell_items[idx]
end
columns() click to toggle source

Returns the number of columns in the table.

# File lib/page-object/elements/table_row.rb, line 29
def columns
  cell_items.size
end
each(&block) click to toggle source

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

# File lib/page-object/elements/table_row.rb, line 11
def each(&block)
  cell_items.each(&block)
end

Protected Instance Methods

cell_items() click to toggle source
# File lib/page-object/elements/table_row.rb, line 35
def cell_items
  @cell_items ||= element.cells.map do |obj|
    ::PageObject::Elements::TableCell.new(obj)
  end
end
find_index(what) click to toggle source
# File lib/page-object/elements/table_row.rb, line 41
def find_index(what)
  return what if what.is_a? Integer

  parent(tag_name: 'table').headers.find_index do |header|
    header.text.include? what
  end
end