Class: TestCentricity::ListElement
- Defined in:
- lib/testcentricity_web/elements/list_element.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#element_locator ⇒ Object
Returns the value of attribute element_locator.
-
#list ⇒ Object
Returns the value of attribute list.
Attributes inherited from UIElement
#alt_locator, #context, #locator, #name, #parent, #type
Instance Method Summary collapse
- #click(row) ⇒ Object
- #exists?(row) ⇒ Boolean
- #find_list_element(row, visible = true) ⇒ Object
- #get_value(row, visible = true) ⇒ Object (also: #get_caption)
-
#initialize(name, parent, locator, context, list) ⇒ ListElement
constructor
A new instance of ListElement.
- #list_object_not_found_exception(obj, obj_type, row) ⇒ Object
Methods inherited from UIElement
#clear_alt_locator, #click_at, #disabled?, #double_click, #drag_and_drop, #drag_by, #enabled?, #get_attribute, #get_locator, #get_name, #get_native_attribute, #get_object_type, #get_siebel_object_type, #hidden?, #hover, #invoke_siebel_dialog, #right_click, #send_keys, #set, #set_alt_locator, #verify_value, #visible?, #wait_until_exists, #wait_until_gone, #wait_until_hidden, #wait_until_value_changes, #wait_until_value_is, #wait_until_visible
Constructor Details
#initialize(name, parent, locator, context, list) ⇒ ListElement
Returns a new instance of ListElement.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 6 def initialize(name, parent, locator, context, list) @name = name @parent = parent @context = context @alt_locator = nil @list = list @element_locator = locator locator.nil? ? @locator = list.get_list_row_locator('ROW_SPEC') : @locator = "#{list.get_list_row_locator('ROW_SPEC')}/#{@element_locator}" end |
Instance Attribute Details
#element_locator ⇒ Object
Returns the value of attribute element_locator.
4 5 6 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 4 def element_locator @element_locator end |
#list ⇒ Object
Returns the value of attribute list.
3 4 5 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 3 def list @list end |
Instance Method Details
#click(row) ⇒ Object
23 24 25 26 27 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 23 def click(row) obj, = find_list_element(row) list_object_not_found_exception(obj, @type, row) obj.click end |
#exists?(row) ⇒ Boolean
18 19 20 21 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 18 def exists?(row) obj, = find_list_element(row) obj != nil end |
#find_list_element(row, visible = true) ⇒ Object
42 43 44 45 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 42 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) ⇒ Object Also known as: get_caption
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 29 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 |
#list_object_not_found_exception(obj, obj_type, row) ⇒ Object
47 48 49 |
# File 'lib/testcentricity_web/elements/list_element.rb', line 47 def list_object_not_found_exception(obj, obj_type, row) object_not_found_exception(obj, "Row #{row} #{obj_type}") end |