Sha256: 247bcb71934db9937653ded31f6e62556b1785b444875b49d4e3730c0d077f73

Contents?: true

Size: 786 Bytes

Versions: 20

Compression:

Stored size: 786 Bytes

Contents

module Watir
  class TableCell < HTMLElement
    def column_header
      current_row = parent(tag_name: 'tr')
      header_row(current_row, index: previous_siblings.size).text
    end

    def sibling_from_header(opt)
      current_row = parent(tag_name: 'tr')
      header = header_row(current_row, opt)
      index = header.previous_siblings.size

      self.class.new(current_row, tag_name: 'td', index: index)
    end

    private

    def header_row(current_row, opt)
      table = parent(tag_name: 'table')
      header_row = table.tr

      table.cell_size_check(header_row, current_row)

      header_type = table.th.exist? ? 'th' : 'tr'
      opt[:tag_name] = header_type

      Watir.tag_to_class[header_type.to_sym].new(header_row, opt)
    end
  end # TableCell
end # Watir

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
watir-7.1.0 lib/watir/elements/table_cell.rb
watir-7.0.0 lib/watir/elements/table_cell.rb
watir-7.0.0.beta5 lib/watir/elements/table_cell.rb
watir-7.0.0.beta4 lib/watir/elements/table_cell.rb
watir-7.0.0.beta3 lib/watir/elements/table_cell.rb
watir-7.0.0.beta2 lib/watir/elements/table_cell.rb
watir-7.0.0.beta1 lib/watir/elements/table_cell.rb
watir-6.19.1 lib/watir/elements/table_cell.rb
watir-6.19.0 lib/watir/elements/table_cell.rb
watir-6.18.0 lib/watir/elements/table_cell.rb
watir-6.17.0 lib/watir/elements/table_cell.rb
watir-6.16.5 lib/watir/elements/table_cell.rb
watir-6.16.4 lib/watir/elements/table_cell.rb
watir-6.16.3 lib/watir/elements/table_cell.rb
watir-6.16.2 lib/watir/elements/table_cell.rb
watir-6.16.1 lib/watir/elements/table_cell.rb
watir-6.16.0 lib/watir/elements/table_cell.rb
watir-6.15.1 lib/watir/elements/table_cell.rb
watir-6.15.0 lib/watir/elements/table_cell.rb
watir-6.14.0 lib/watir/elements/table_cell.rb