Class: Watir::RadioCheckCommon

Inherits:
InputElement show all
Defined in:
lib/watir/input_elements.rb,
lib/watir/camel_case.rb

Overview

This class contains common methods to both radio buttons and check boxes. Normally a user would not need to create this object as it is returned by the Watir::Container#checkbox or by Watir::Container#radio methods – most of the methods available to this element are inherited from the Element class

Direct Known Subclasses

CheckBox, Radio

Constant Summary

Constants inherited from Element

Element::TO_S_SIZE

Instance Attribute Summary

Attributes inherited from Element

#container

Attributes included from Container

#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed

Instance Method Summary collapse

Methods inherited from Element

#<=>, #activeObjectHighLightColor, #after_text, #assert_enabled, #assert_exists, #attribute_value, #before_text, #click, #click!, #click_no_wait, #document, #enabled?, #exists?, #fire_event, #flash, #focus, #ole_object, #ole_object=, #parent, #text, #to_s, #type_keys, #typingspeed, #visible?

Methods included from Container

#area, #areas, #button, #buttons, #cell, #cells, #checkbox, #checkboxes, #dds, #divs, #dls, #dts, #element, #elements, #ems, #file_field, #file_fields, #form, #forms, #frame, #hidden, #hiddens, #image, #images, #labels, #link, #links, #lis, #locate_all_elements, #locate_input_element, #locate_tagged_element, #log, #map, #maps, #modal_dialog, #popup, #pres, #ps, #radio, #radios, #row, #rows, #select_list, #select_lists, #set_container, #show_all_objects, #spans, #strongs, #table, #tables, #text_field, #text_fields, #wait

Constructor Details

#initialize(container, how, what, value = nil) ⇒ RadioCheckCommon

Returns a new instance of RadioCheckCommon.



532
533
534
535
# File 'lib/watir/input_elements.rb', line 532

def initialize(container, how, what, value=nil)
  super container, how, what
  @value = value
end

Instance Method Details

#getStateObject



50
# File 'lib/watir/camel_case.rb', line 50

alias getState set?

#inspectObject



537
538
539
# File 'lib/watir/input_elements.rb', line 537

def inspect
  '#<%s:0x%x located=%s how=%s what=%s value=%s>' % [self.class, hash*2, !!ole_object, @how.inspect, @what.inspect, @value.inspect]
end

#isSet?Object



51
# File 'lib/watir/camel_case.rb', line 51

alias isSet?   set?

#locateObject

:nodoc:



529
530
531
# File 'lib/watir/input_elements.rb', line 529

def locate #:nodoc:
  @o = @container.locate_input_element(@how, @what, self.class::INPUT_TYPES, @value, self.class)
end

#set?Boolean Also known as: checked?

This method determines if a radio button or check box is set. Returns true if set/checked; false if not set/checked. Raises UnknownObjectException if its unable to locate an object.

Returns:

  • (Boolean)


544
545
546
547
# File 'lib/watir/input_elements.rb', line 544

def set? 
  assert_exists
  return @o.checked
end