Class: Watir::Option
- Defined in:
- lib/watir-classic/input_elements.rb
Overview
Returned by Container#option.
Instance Attribute Summary
Attributes inherited from Element
Attributes included from Container
Instance Method Summary collapse
-
#clear ⇒ Object
Clear option in multi-select list.
-
#disabled? ⇒ String, ...
Retrieve element’s disabled? from the OLE method.
-
#label ⇒ String, ...
Retrieve element’s label from the OLE method.
-
#name ⇒ String, ...
Retrieve element’s name from the OLE method.
-
#select ⇒ Object
Select the option in its select list.
-
#selected? ⇒ Boolean
True when option is selected, false otherwise.
-
#text ⇒ Object
Text of the option.
-
#value ⇒ String, ...
Retrieve element’s value from the OLE method.
Methods inherited from Element
#<=>, #attribute_value, #class_name, #click, #double_click, #enabled?, #exists?, #fire_event, #flash, #focus, #focused?, #id, #initialize, #inner_html, #inspect, #method_missing, #ole_object, #outer_html, #parent, #right_click, #send_keys, #style, #tag_name, #title, #to_s, #to_subtype, #unique_number, #visible?
Methods included from DragAndDropHelper
#drag_and_drop_by, #drag_and_drop_on
Methods included from Container
#a, #abbr, #address, #alert, #area, #article, #aside, #audio, #b, #base, #bdi, #bdo, #blockquote, #body, #br, #button, #canvas, #caption, #checkbox, #cite, #code, #col, #colgroup, #command, #data, #datalist, #dd, #del, #details, #dfn, #div, #dl, #dt, #element, #em, #embed, #fieldset, #figcaption, #figure, #file_field, #font, #footer, #form, #frame, #frameset, #h1, #h2, #h3, #h4, #h5, #h6, #head, #header, #hgroup, #hidden, #hr, #i, #img, #input, #ins, #kbd, #keygen, #legend, #li, #map, #mark, #menu, #meta, #meter, #modal_dialog, #nav, #noscript, #object, #ol, #optgroup, #option, #output, #p, #param, #pre, #progress, #q, #radio, #rp, #rt, #ruby, #s, #samp, #script, #section, #small, #source, #span, #strong, #style, #sub, #summary, #sup, #table, #tbody, #td, #text_field, #textarea, #tfoot, #th, #thead, #time, #title, #tr, #track, #u, #ul, #var, #video, #wbr
Methods included from Exception
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
#clear ⇒ Object
Clear option in multi-select list.
138 139 140 141 142 143 144 |
# File 'lib/watir-classic/input_elements.rb', line 138 def clear raise TypeError, "you can only clear multi-selects" unless select_list.multiple? perform_action do change_selected false if selected? end end |
#disabled? ⇒ String, ...
Retrieve element’s disabled? from the OLE method.
118 |
# File 'lib/watir-classic/input_elements.rb', line 118 attr_ole :disabled? |
#label ⇒ String, ...
Retrieve element’s label from the OLE method.
121 |
# File 'lib/watir-classic/input_elements.rb', line 121 attr_ole :label |
#name ⇒ String, ...
Retrieve element’s name from the OLE method.
119 |
# File 'lib/watir-classic/input_elements.rb', line 119 attr_ole :name |
#select ⇒ Object
Select the option in its select list.
127 128 129 130 131 |
# File 'lib/watir-classic/input_elements.rb', line 127 def select perform_action do change_selected true unless selected? end end |
#selected? ⇒ Boolean
Returns true when option is selected, false otherwise.
148 149 150 151 |
# File 'lib/watir-classic/input_elements.rb', line 148 def selected? assert_exists ole_object.selected end |
#text ⇒ Object
Text of the option.
154 155 156 157 |
# File 'lib/watir-classic/input_elements.rb', line 154 def text l = label l.empty? ? super : l rescue '' end |
#value ⇒ String, ...
Retrieve element’s value from the OLE method.
120 |
# File 'lib/watir-classic/input_elements.rb', line 120 attr_ole :value |