Sha256: b15079fd46bddfb2ce1bf2889783500fd43a16cae51a5fdec713c21eefbcfde9

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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

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

    def set_column(column)
      @column  = column
      @locator = "#{@table.get_table_cell_locator('ROW_SPEC', column)}/#{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

1 entries across 1 versions & 1 rubygems

Version Path
testcentricity_web-2.0.8 lib/testcentricity_web/elements/cell_element.rb