module PageObject::Platforms::SeleniumWebDriver::TableRow

Public Instance Methods

[](idx) 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/platforms/selenium_webdriver/table_row.rb, line 13
def [](idx)
  els = table_cells
  idx = find_index_by_title(idx) if idx.kind_of?(String)
  return nil unless idx  && columns >= idx + 1
  initialize_cell(els[idx], :platform => :selenium_webdriver)
end
columns() click to toggle source

Returns the number of columns in the table.

# File lib/page-object/platforms/selenium_webdriver/table_row.rb, line 23
def columns
  table_cells.size
end

Private Instance Methods

find_index_by_title(title) click to toggle source
# File lib/page-object/platforms/selenium_webdriver/table_row.rb, line 29
def find_index_by_title(title)
  table = parent
  parent_tag_name = parent.element.tag_name
  table = table.parent if (parent_tag_name == 'tbody' || parent_tag_name == 'thead')
  table[0].find_index { |column| column.text.include? title }
end
table_cells() click to toggle source
# File lib/page-object/platforms/selenium_webdriver/table_row.rb, line 36
def table_cells
  element.find_elements(:xpath, child_xpath)
end