Class: Watir::CheckBox
- Inherits:
-
RadioCheckCommon
- Object
- Element
- InputElement
- RadioCheckCommon
- Watir::CheckBox
- Defined in:
- lib/watir/input_elements.rb
Overview
This class is the watir representation of a check box. Normally a user would not need to create this object as it is returned by the Watir::Container#checkbox method
Constant Summary collapse
- INPUT_TYPES =
["checkbox"]
Constants inherited from Element
Instance Attribute Summary
Attributes inherited from Element
Attributes included from Container
#activeObjectHighLightColor, #page_container, #type_keys, #typingspeed
Instance Method Summary collapse
-
#clear ⇒ Object
Clears a check box.
-
#set(value = true) ⇒ Object
This method checks or unchecks the checkbox.
Methods inherited from RadioCheckCommon
#getState, #initialize, #inspect, #isSet?, #locate, #set?
Methods inherited from InputElement
Methods inherited from Element
#<=>, #activeObjectHighLightColor, #after_text, #assert_enabled, #assert_exists, #attribute_value, #before_text, #click, #click!, #document, #enabled?, #exists?, #fire_event, #flash, #focus, #initialize, #inspect, #method_missing, #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, #element_by_css, #elements, #ems, #file_field, #file_fields, #form, #forms, #frame, #frames, #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
This class inherits a constructor from Watir::RadioCheckCommon
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Watir::Element
Instance Method Details
#clear ⇒ Object
Clears a check box.
Raises UnknownObjectException if its unable to locate an object
ObjectDisabledException if the object is disabled
615 616 617 |
# File 'lib/watir/input_elements.rb', line 615 def clear set false end |
#set(value = true) ⇒ Object
This method checks or unchecks the checkbox. With no arguments supplied it sets the checkbox. Setting false argument unchecks/clears the checkbox.
Raises UnknownObjectException if it's unable to locate an object
ObjectDisabledException if the object is disabled
602 603 604 605 606 607 608 609 610 |
# File 'lib/watir/input_elements.rb', line 602 def set(value=true) assert_exists assert_enabled highlight :set unless @o.checked == value set_clear_item value end highlight :clear end |