Module: Watir::RadioCheckGroupCommonWatir
- Included in:
- FireWatir::RadioCheckGroup, CheckboxGroup, RadioGroup
- Defined in:
- lib/watirloo/extension/watir_ducktape.rb
Overview
for firefox and ie
Instance Method Summary collapse
-
#[](accessor) ⇒ Object
returns radio object in a group by position or by value in a collection.
-
#get_by_position(position) ⇒ Object
returns Radio||Checkbox from a group that occupies specifi position in a group WARNING: it is 1-based NOT 0-based the intention is to enumerate position staring with 1, the way customer would enumerate items.
-
#get_by_value(value) ⇒ Object
returns Radio||Checkbox from a group that has specific value attribute.
-
#set(what) ⇒ Object
sets control in a group by either position in a group or by hidden value attribute.
-
#size ⇒ Object
(also: #count)
size or count of controls in a group.
-
#values ⇒ Object
returns array of value attributes.
Instance Method Details
#[](accessor) ⇒ Object
returns radio object in a group by position or by value in a collection. FIXME this is a hack
57 58 59 60 61 62 63 |
# File 'lib/watirloo/extension/watir_ducktape.rb', line 57 def [](accessor) if accessor.kind_of? Fixnum get_by_position(accessor+1) elsif accessor.kind_of? String get_by_value accessor end end |
#get_by_position(position) ⇒ Object
returns Radio||Checkbox from a group that occupies specifi position in a group WARNING: it is 1-based NOT 0-based the intention is to enumerate position staring with 1, the way customer would enumerate items
47 48 49 50 51 52 53 |
# File 'lib/watirloo/extension/watir_ducktape.rb', line 47 def get_by_position position if (1..self.size).member? position @o[position-1] else raise ::Watir::Exception::WatirException, "positon #{position} is out of range of size" end end |
#get_by_value(value) ⇒ Object
returns Radio||Checkbox from a group that
has specific value attribute
38 39 40 |
# File 'lib/watirloo/extension/watir_ducktape.rb', line 38 def get_by_value value raise ::Watir::Exception::WatirException, "method should be implemented" end |
#set(what) ⇒ Object
sets control in a group by either position in a group or by hidden value attribute
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/watirloo/extension/watir_ducktape.rb', line 17 def set(what) if what.kind_of?(Array) what.each {|thing| set thing } #calls itself with Fixnum or String else if what.kind_of?(Fixnum) get_by_position(what).set elsif what.kind_of?(String) get_by_value(what).set else raise ::Watir::Exception::WatirException, "argument error #{what} not allowed" end end end |
#size ⇒ Object Also known as: count
size or count of controls in a group
10 11 12 |
# File 'lib/watirloo/extension/watir_ducktape.rb', line 10 def size @o.size end |