Class: FireWatir::CheckBox

Inherits:
RadioCheckCommon show all
Defined in:
lib/firewatir/elements/radio_check_common.rb

Overview

Description: Class for Checkbox element.

Constant Summary

Constants inherited from Element

Element::FIRST_ORDERED_NODE_TYPE, Element::NUMBER_TYPE, Element::ORDERED_NODE_ITERATOR_TYPE, Element::TO_S_SIZE

Constants included from Container

FireWatir::Container::DEFAULT_HIGHLIGHT_COLOR, FireWatir::Container::MACHINE_IP

Instance Attribute Summary

Attributes inherited from RadioCheckCommon

#element_name

Attributes inherited from Element

#element_name

Instance Method Summary collapse

Methods inherited from RadioCheckCommon

#locate, #set?

Methods inherited from Element

#assert_enabled, #assert_exists, #attribute_value, #click, #contains_text, #disabled, #document_var, #element_by_xpath, #element_type, #elements_by_xpath, #enabled?, #exists?, #fire_event, #inspect, #method_missing, #text, #to_s, #visible?, #wait

Methods included from Container

#button, #cell, #checkbox, #dd, #dl, #dt, #file_field, #form, #frame, #hidden, #image, #link, #radio, #row, #select_list, #show_all_objects, #table, #text_field

Methods included from JsshSocket

#js_eval, #js_eval_method, #jssh_socket, #read_socket

Constructor Details

#initialize(*args) ⇒ CheckBox

Returns a new instance of CheckBox.



118
119
120
121
# File 'lib/firewatir/elements/radio_check_common.rb', line 118

def initialize *args
  super
  @type = ["checkbox"]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FireWatir::Element

Instance Method Details

#clearObject

Description:

Unchecks the checkbox.
Raises ObjectDisabledException exception if the object is disabled


152
153
154
155
156
157
158
159
160
# File 'lib/firewatir/elements/radio_check_common.rb', line 152

def clear
  assert_exists
  assert_enabled
  highlight( :set)
  if @o.checked == true
    set_clear_item( false )
  end
  highlight( :clear)
end

#set(set_or_clear = true) ⇒ Object

Description:

Checks or unchecks the checkbox. If no value is supplied it will check the checkbox.
Raises ObjectDisabledException exception if the object is disabled

Input:

- set_or_clear - Parameter indicated whether to check or uncheck the checkbox.
                 True to check the check box, false for unchecking the checkbox.


132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/firewatir/elements/radio_check_common.rb', line 132

def set( set_or_clear=true )
  assert_exists
  assert_enabled
  highlight(:set)

  if set_or_clear == true
    if @o.checked == false
      set_clear_item( true )
    end
  else
    self.clear
  end
  highlight(:clear )
end