Sha256: 1772acc002d89429c840f91c219bd48ff6bd6152b417647cefaa5e5ba04bda04

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

module TestCentricity
  class CellElement < UIElement
    attr_accessor :table
    attr_accessor :column
    attr_accessor :element_locator

    def initialize(name, parent, locator, context, table, column)
      @name            = name
      @parent          = parent
      @context         = context
      @alt_locator     = nil
      @table           = table
      @column          = column
      @element_locator = locator
      @locator         = "#{@table.get_table_cell_locator('ROW_SPEC', @column)}/#{@element_locator}"
    end

    def set_column(column)
      @column  = column
      @locator = "#{@table.get_table_cell_locator('ROW_SPEC', @column)}/#{@element_locator}"
    end

    def exists?(row)
      obj, = find_cell_element(row)
      obj != nil
    end

    def click(row)
      obj, = find_cell_element(row)
      cell_object_not_found_exception(obj, @type, row)
      obj.click
    end

    def find_cell_element(row)
      set_alt_locator("#{@locator.gsub('ROW_SPEC', row.to_s)}")
      find_element
    end

    def cell_object_not_found_exception(obj, obj_type, row)
      object_not_found_exception(obj, "Row #{row}/Col #{@column} #{obj_type}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
testcentricity_web-2.0.12 lib/testcentricity_web/elements/cell_element.rb
testcentricity_web-2.0.11 lib/testcentricity_web/elements/cell_element.rb
testcentricity_web-2.0.10 lib/testcentricity_web/elements/cell_element.rb
testcentricity_web-2.0.9 lib/testcentricity_web/elements/cell_element.rb