Class: TestCentricity::Radio

Inherits:
UIElement show all
Defined in:
lib/testcentricity_web/elements/radio.rb

Instance Attribute Summary

Attributes inherited from UIElement

#alt_locator, #context, #locator, #parent, #type

Instance Method Summary collapse

Methods inherited from UIElement

#clear_alt_locator, #click, #click_at, #disabled?, #double_click, #drag_by, #enabled?, #exists?, #get_list_items, #get_locator, #get_object_type, #get_siebel_object_type, #get_value, #hidden?, #hover, #invoke_siebel_dialog, #send_keys, #set, #set_alt_locator, #verify_value, #visible?, #wait_until_exists, #wait_until_gone, #wait_until_value_changes, #wait_until_value_is

Constructor Details

#initialize(parent, locator, context) ⇒ Radio

Returns a new instance of Radio.



4
5
6
7
8
9
10
# File 'lib/testcentricity_web/elements/radio.rb', line 4

def initialize(parent, locator, context)
  @parent  = parent
  @locator = locator
  @context = context
  @type    = :radio
  @alt_locator = nil
end

Instance Method Details

#select ⇒ Object

Set the selected state of a radio button object.

Examples:

accept_terms_radio.select


42
43
44
# File 'lib/testcentricity_web/elements/radio.rb', line 42

def select
  set_selected_state(true)
end

#selected? ⇒ Boolean

Is radio button selected?

Examples:

accept_terms_radio.selected?

Returns:

  • (Boolean)


18
19
20
21
22
# File 'lib/testcentricity_web/elements/radio.rb', line 18

def selected?
  obj, _ = find_element
  object_not_found_exception(obj, 'Radio')
  obj.checked?
end

#set_selected_state(state) ⇒ Object

Set the select state of a radio button object.

Examples:

accept_terms_radio.set_selected_state(true)

Parameters:

  • state (Boolean) —

    true = selected / false = unselected



30
31
32
33
34
35
# File 'lib/testcentricity_web/elements/radio.rb', line 30

def set_selected_state(state)
  obj, _ = find_element
  object_not_found_exception(obj, 'Radio')
  invalid_object_type_exception(obj, 'radio')
  obj.set(state)
end

#unselect ⇒ Object

Unselect a radio button object.

Examples:

accept_terms_radio.unselect


51
52
53
# File 'lib/testcentricity_web/elements/radio.rb', line 51

def unselect
  set_selected_state(false)
end