Class: TestCentricity::CellElement
- Defined in:
- lib/testcentricity_web/web_elements/cell_element.rb
Direct Known Subclasses
Constant Summary
Constants inherited from UIElement
UIElement::CSS_SELECTORS, UIElement::XPATH_SELECTORS
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#element_locator ⇒ Object
Returns the value of attribute element_locator.
-
#table ⇒ Object
Returns the value of attribute table.
Attributes inherited from UIElement
#alt_locator, #context, #locator, #locator_type, #name, #original_style, #parent, #type
Instance Method Summary collapse
- #cell_object_not_found_exception(obj, obj_type, row) ⇒ Object
- #click(row) ⇒ Object
- #exists?(row) ⇒ Boolean
- #find_cell_element(row, visible = true) ⇒ Object
- #get_native_attribute(row, attrib) ⇒ Object
- #get_value(row, visible = true) ⇒ Object (also: #get_caption)
-
#initialize(name, parent, locator, context, table, column, proxy = nil) ⇒ CellElement
constructor
A new instance of CellElement.
- #set_column(column) ⇒ Object
Methods inherited from UIElement
#aria_checked?, #aria_colcount, #aria_describedby, #aria_disabled?, #aria_expanded?, #aria_haspopup?, #aria_hidden?, #aria_invalid?, #aria_label, #aria_labelledby, #aria_live, #aria_pressed?, #aria_readonly?, #aria_required?, #aria_rowcount, #aria_selected?, #aria_sort, #clear_alt_locator, #click_at, #count, #disabled?, #displayed?, #double_click, #drag_and_drop, #drag_by, #enabled?, #get_attribute, #get_locator, #get_locator_type, #get_name, #get_object_type, #get_siebel_object_type, #height, #hidden?, #highlight, #hover, #hover_at, #invoke_siebel_dialog, #right_click, #role, #send_keys, #set, #set_alt_locator, #set_locator_type, #style, #tabindex, #title, #unhighlight, #verify_value, #visible?, #wait_until_exists, #wait_until_gone, #wait_until_hidden, #wait_until_value_changes, #wait_until_value_is, #wait_until_visible, #width, #x, #y
Constructor Details
#initialize(name, parent, locator, context, table, column, proxy = nil) ⇒ CellElement
Returns a new instance of CellElement.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/testcentricity_web/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 |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
4 5 6 |
# File 'lib/testcentricity_web/web_elements/cell_element.rb', line 4 def column @column end |
#element_locator ⇒ Object
Returns the value of attribute element_locator.
5 6 7 |
# File 'lib/testcentricity_web/web_elements/cell_element.rb', line 5 def element_locator @element_locator end |
#table ⇒ Object
Returns the value of attribute table.
3 4 5 |
# File 'lib/testcentricity_web/web_elements/cell_element.rb', line 3 def table @table end |
Instance Method Details
#cell_object_not_found_exception(obj, obj_type, row) ⇒ Object
65 66 67 |
# File 'lib/testcentricity_web/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) ⇒ Object
35 36 37 38 39 |
# File 'lib/testcentricity_web/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) ⇒ Boolean
30 31 32 33 |
# File 'lib/testcentricity_web/web_elements/cell_element.rb', line 30 def exists?(row) obj, = find_cell_element(row) obj != nil end |
#find_cell_element(row, visible = true) ⇒ Object
60 61 62 63 |
# File 'lib/testcentricity_web/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_native_attribute(row, attrib) ⇒ Object
41 42 43 44 45 |
# File 'lib/testcentricity_web/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) ⇒ Object Also known as:
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/testcentricity_web/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 |
#set_column(column) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/testcentricity_web/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 |