module PageObject::Platforms::SeleniumWebDriver::Table
Public Instance Methods
[](idx)
click to toggle source
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.
@return [PageObject::Elements::TableRow]
# File lib/page-object/platforms/selenium_webdriver/table.rb, line 13 def [](idx) eles = table_rows idx = find_index_by_title(idx, eles) if idx.kind_of?(String) return nil unless idx initialize_row(eles[idx], :platform => :selenium_webdriver) end
rows()
click to toggle source
Returns the number of rows in the table.
# File lib/page-object/platforms/selenium_webdriver/table.rb, line 23 def rows table_rows.size end
Private Instance Methods
find_index_by_title(row_title, eles)
click to toggle source
# File lib/page-object/platforms/selenium_webdriver/table.rb, line 29 def find_index_by_title(row_title, eles) eles.find_index do |row| columns = row.find_elements(:xpath, ".//child::td|th") columns.any? { |col| col.text.include? row_title } end end
table_rows()
click to toggle source
# File lib/page-object/platforms/selenium_webdriver/table.rb, line 36 def table_rows element.find_elements(:xpath, child_xpath) end