Sha256: 5d66cf138f7d94ef9e60d9f6544a427916b8da5376bd584f3e8c39981c2321ea
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
module Symbiont module WebObjects class TableRow < WebObject include Enumerable # This method is used to return a TableCell object based on the index provided. When # the index provided is a string, the text will be matched with the text from the # columns in the first row. # @return [Symbiont::WebObjects::TableCell] def [](index) index = find_by_title(index) if index.kind_of?(String) Object::Symbiont::WebObjects::TableCell.new(@web_object[index]) end # This method is an iterator that returns a TableCell object each time through # the loop. # @return [Symbiont::WebObjects::TableCell] def each for index in 1..self.columns do yield self[index - 1] end end # This method returns the number of columns in a table object. def columns @web_object.wd.find_elements(:xpath, cell_xpath).size end protected def cell_xpath ".//child::td|th" end private def find_by_title(column_text) table = @web_object.parent first_row = table[0] first_row.cells.find_index {|column| column.text == column_text} end end # class: TableRow end # module: WebObjects end # module: Symbiont
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
symbiont-0.1.2 | lib/symbiont/web_objects/table_row.rb |