class TestCentricity::Radio

Attributes

proxy[RW]

Public Class Methods

new(name, parent, locator, context, proxy = nil) click to toggle source
# File lib/testcentricity_web/web_elements/radio.rb, line 5
def initialize(name, parent, locator, context, proxy = nil)
  @name        = name
  @parent      = parent
  @locator     = locator
  @context     = context
  @alt_locator = nil
  @proxy       = proxy
  @type        = :radio
  set_locator_type
end

Public Instance Methods

disabled?() click to toggle source

Is radio button disabled (not enabled)?

@return [Boolean] @example

accept_terms_radio.disabled?
# File lib/testcentricity_web/web_elements/radio.rb, line 55
def disabled?
  visibility = @proxy.nil? ? true : :all
  obj, type = find_element(visibility)
  object_not_found_exception(obj, type)
  obj.disabled?
end
exists?() click to toggle source

Does radio button object exists?

@return [Boolean] @example

accept_terms_radio.exists?
# File lib/testcentricity_web/web_elements/radio.rb, line 22
def exists?
  obj, = find_object(:all)
  obj != nil
end
get_value() click to toggle source

Return radio button caption

@return [Boolean] @example

accept_terms_radio.get_value
Calls superclass method
# File lib/testcentricity_web/web_elements/radio.rb, line 68
def get_value
  @proxy.nil? ? super : @proxy.get_value
end
highlight(duration = 1) click to toggle source

Highlight a radio button with a 3 pixel wide, red dashed border for the specified wait time. If wait time is zero, then the highlight will remain until the page is refreshed

@param duration [Integer or Float] wait time in seconds @example

accept_terms_radio.highlight(3)
Calls superclass method
# File lib/testcentricity_web/web_elements/radio.rb, line 114
def highlight(duration = 1)
  @proxy.nil? ? super : @proxy.highlight(duration)
end
select() click to toggle source

Set the selected state of a radio button object.

@example

accept_terms_radio.select
# File lib/testcentricity_web/web_elements/radio.rb, line 94
def select
  set_selected_state(true)
end
selected?() click to toggle source

Is radio button selected?

@return [Boolean] @example

accept_terms_radio.selected?
# File lib/testcentricity_web/web_elements/radio.rb, line 33
def selected?
  obj, = find_element(:all)
  object_not_found_exception(obj, 'Radio')
  obj.checked?
end
set_selected_state(state) click to toggle source

Set the select state of a radio button object.

@param state [Boolean] true = selected / false = unselected @example

accept_terms_radio.set_selected_state(true)
# File lib/testcentricity_web/web_elements/radio.rb, line 78
def set_selected_state(state)
  obj, = find_element(:all)
  object_not_found_exception(obj, 'Radio')
  invalid_object_type_exception(obj, 'radio')
  if @proxy.nil?
    obj.set(state)
  else
    @proxy.click unless state == obj.checked?
  end
end
unhighlight() click to toggle source

Restore a highlighted radio button's original style

@example

accept_terms_radio.unhighlight
Calls superclass method
# File lib/testcentricity_web/web_elements/radio.rb, line 123
def unhighlight
  @proxy.nil? ? super : @proxy.unhighlight
end
unselect() click to toggle source

Unselect a radio button object.

@example

accept_terms_radio.unselect
# File lib/testcentricity_web/web_elements/radio.rb, line 103
def unselect
  set_selected_state(state = false)
end
visible?() click to toggle source

Is radio button visible?

@return [Boolean] @example

accept_terms_radio.visible?
Calls superclass method
# File lib/testcentricity_web/web_elements/radio.rb, line 45
def visible?
  @proxy.nil? ? super : @proxy.visible?
end