Sha256: e9d1d25801107f193e247e02362082ea08a0cfc48b898b2c3e6a5640a10ad56e
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
require 'watir/elements/html_elements' module PageObject module Elements class TableRow < Element include Enumerable # # iterator that yields with a PageObject::Elements::TableCell # def each(&block) cell_items.each(&block) end # # 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. # def [](what) idx = find_index(what) idx && cell_items[idx] end # # Returns the number of columns in the table. # def columns cell_items.size end protected def cell_items @cell_items ||= element.cells.map do |obj| ::PageObject::Elements::TableCell.new(obj) end end 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 end ::PageObject::Elements.tag_to_class[:tr] = ::PageObject::Elements::TableRow end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
centric_page_object-2.3.1 | lib/page-object/elements/table_row.rb |
page-object-2.3.1 | lib/page-object/elements/table_row.rb |
page-object-2.3.0 | lib/page-object/elements/table_row.rb |