Class: TestCentricity::Range

Inherits:
TextField show all
Defined in:
lib/testcentricity_web/web_elements/range.rb

Constant Summary

Constants inherited from UIElement

UIElement::CSS_SELECTORS, UIElement::XPATH_SELECTORS

Instance Attribute Summary

Attributes inherited from UIElement

#alt_locator, #context, #locator, #locator_type, #name, #original_style, #parent, #type

Instance Method Summary collapse

Methods inherited from TextField

#clear, #get_max, #get_max_length, #get_min, #get_placeholder, #get_step, #read_only?

Methods inherited from UIElement

#aria_autocomplete, #aria_busy?, #aria_checked?, #aria_colcount, #aria_controls, #aria_describedby, #aria_disabled?, #aria_expanded?, #aria_haspopup?, #aria_hidden?, #aria_invalid?, #aria_keyshortcuts, #aria_label, #aria_labelledby, #aria_live, #aria_modal?, #aria_multiline?, #aria_multiselectable?, #aria_orientation, #aria_pressed?, #aria_readonly?, #aria_required?, #aria_roledescription, #aria_rowcount, #aria_selected?, #aria_sort, #aria_valuemax, #aria_valuemin, #aria_valuenow, #aria_valuetext, #clear_alt_locator, #click, #click_at, #content_editable?, #count, #disabled?, #displayed?, #double_click, #drag_and_drop, #drag_by, #enabled?, #exists?, #find_element, #focused?, #get_attribute, #get_locator, #get_locator_type, #get_name, #get_native_attribute, #get_object_type, #get_siebel_object_type, #height, #hidden?, #highlight, #hover, #hover_at, #inspect, #invoke_siebel_dialog, #obscured?, #right_click, #role, #scroll_to, #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) ⇒ Range

Returns a new instance of Range.



3
4
5
6
# File 'lib/testcentricity_web/web_elements/range.rb', line 3

def initialize(name, parent, locator, context)
  super
  @type = :range
end

Instance Method Details

#get_value(visible = true) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/testcentricity_web/web_elements/range.rb', line 21

def get_value(visible = true)
  obj, type = find_element(visible)
  object_not_found_exception(obj, type)
  result = obj.value
  unless result.blank?
    if result.is_int?
      result.to_i
    elsif result.is_float?
      result.to_f
    else
      result
    end
  end
end

#value=(value) ⇒ Object

Set the value property of a range type input object.

Examples:

volume_level.value = 11

Parameters:

  • value (Integer)


14
15
16
17
18
19
# File 'lib/testcentricity_web/web_elements/range.rb', line 14

def value=(value)
  obj, = find_element
  object_not_found_exception(obj, nil)
  page.execute_script('arguments[0].value = arguments[1]', obj, value)
  obj.send_keys(:right)
end