Class: Watir::Option

Inherits:
Element show all
Defined in:
lib/watir-classic/input_elements.rb

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

#<=>, #__ole_inner_elements, #activeObjectHighLightColor, #assert_enabled, #assert_exists, #attribute_value, #click, #click!, #create_event, #disabled?, #dispatch_event, #document, #double_click, #enabled?, #exists?, #fire_event, #flash, #focus, #focused?, #initialize, #inspect, #locate, #method_missing, #ole_object, #ole_object=, #parent, #right_click, #send_keys, #style, #tag_name, #to_s, #to_subtype, #type_keys, #typingspeed, #visible?

Methods included from DragAndDropHelper

#drag_and_drop_by, #drag_and_drop_on

Methods included from Container

#__ole_inner_elements, #alert, #locator_for, #modal_dialog, #set_container, support_element, #wait

Methods included from Exception

message_for_unable_to_locate

Methods included from ElementExtensions

#present?, #wait_until_present, #wait_while_present, #when_present

Constructor Details

This class inherits a constructor from Watir::Element

Dynamic Method Handling

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

Instance Method Details

#clearObject

Raises:

  • (TypeError)


101
102
103
104
105
106
107
# File 'lib/watir-classic/input_elements.rb', line 101

def clear
  raise TypeError, "you can only clear multi-selects" unless select_list.multiple?

  perform_action do
    change_selected false if selected?
  end
end

#selectObject



95
96
97
98
99
# File 'lib/watir-classic/input_elements.rb', line 95

def select
  perform_action do
    change_selected true unless selected?
  end
end

#selected?Boolean

Returns:

  • (Boolean)


109
110
111
112
# File 'lib/watir-classic/input_elements.rb', line 109

def selected?
  assert_exists
  ole_object.selected
end

#textObject



114
115
116
117
# File 'lib/watir-classic/input_elements.rb', line 114

def text
  l = label
  l.empty? ? super : l rescue ''
end