class TestCentricity::CellElement

Attributes

column[RW]
element_locator[RW]
table[RW]

Public Class Methods

new(name, parent, locator, context, table, column, proxy = nil) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 7
def initialize(name, parent, locator, context, table, column, proxy = nil)
  @name            = name
  @parent          = parent
  @context         = context
  @alt_locator     = nil
  @table           = table
  @column          = column
  @element_locator = locator

  set_locator_type(@table.get_locator)
  set_column(column)
end

Public Instance Methods

cell_object_not_found_exception(obj, obj_type, row) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 65
def cell_object_not_found_exception(obj, obj_type, row)
  object_not_found_exception(obj, "Row #{row}/Col #{@column} #{obj_type}")
end
click(row) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 35
def click(row)
  obj, = find_cell_element(row)
  cell_object_not_found_exception(obj, @type, row)
  obj.click
end
exists?(row) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 30
def exists?(row)
  obj, = find_cell_element(row)
  obj != nil
end
find_cell_element(row, visible = true) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 60
def find_cell_element(row, visible = true)
  set_alt_locator("#{@locator.gsub('ROW_SPEC', row.to_s)}")
  find_element(visible)
end
get_caption(row, visible = true)
Alias for: get_value
get_native_attribute(row, attrib) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 41
def get_native_attribute(row, attrib)
  obj, = find_cell_element(row)
  cell_object_not_found_exception(obj, @type, row)
  obj.get_native_attribute(attrib)
end
get_value(row, visible = true) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 47
def get_value(row, visible = true)
  obj, = find_cell_element(row, visible)
  cell_object_not_found_exception(obj, @type, row)
  case obj.tag_name.downcase
  when 'input', 'select', 'textarea'
    obj.value
  else
    obj.text
  end
end
Also aliased as: get_caption
set_column(column) click to toggle source
# File lib/testcentricity/web_elements/cell_element.rb, line 20
def set_column(column)
  @column  = column
  case @locator_type
  when :xpath
    @locator = "#{@table.get_table_cell_locator('ROW_SPEC', @column)}/#{@element_locator}"
  when :css
    @locator = "#{@table.get_table_cell_locator('ROW_SPEC', @column)} > #{@element_locator}"
  end
end