class TestCentricity::ListElement
Attributes
element_locator[RW]
list[RW]
Public Class Methods
new(name, parent, locator, context, list, proxy = nil)
click to toggle source
# File lib/testcentricity/web_elements/list_element.rb, line 6 def initialize(name, parent, locator, context, list, proxy = nil) @name = name @parent = parent @context = context @alt_locator = nil @list = list @element_locator = locator set_locator_type(@list.get_locator) if locator.nil? @locator = list.get_list_row_locator('ROW_SPEC') else case @locator_type when :xpath @locator = "#{list.get_list_row_locator('ROW_SPEC')}/#{@element_locator}" when :css @locator = "#{list.get_list_row_locator('ROW_SPEC')} > #{@element_locator}" end end end
Public Instance Methods
click(row)
click to toggle source
# File lib/testcentricity/web_elements/list_element.rb, line 33 def click(row) obj, = find_list_element(row) list_object_not_found_exception(obj, @type, row) obj.click end
exists?(row)
click to toggle source
# File lib/testcentricity/web_elements/list_element.rb, line 28 def exists?(row) obj, = find_list_element(row) obj != nil end
find_list_element(row, visible = true)
click to toggle source
# File lib/testcentricity/web_elements/list_element.rb, line 52 def find_list_element(row, visible = true) set_alt_locator("#{@locator.gsub('ROW_SPEC', row.to_s)}") find_element(visible) end
get_value(row, visible = true)
click to toggle source
# File lib/testcentricity/web_elements/list_element.rb, line 39 def get_value(row, visible = true) obj, = find_list_element(row, visible) list_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
list_object_not_found_exception(obj, obj_type, row)
click to toggle source
# File lib/testcentricity/web_elements/list_element.rb, line 57 def list_object_not_found_exception(obj, obj_type, row) object_not_found_exception(obj, "Row #{row} #{obj_type}") end