Class: Watir::Input
- Inherits:
-
HTMLElement
- Object
- BaseElement
- HTMLElement
- Watir::Input
- Defined in:
- lib/watir-webdriver/elements/input.rb,
lib/watir-webdriver/elements/generated.rb,
lib/watir-webdriver/elements/generated.rb
Constant Summary
Constants inherited from BaseElement
BaseElement::IGNORED_ATTRIBUTES
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #to_button ⇒ Object
-
#to_checkbox ⇒ Object
not sure about this.
- #to_radio ⇒ Object
- #to_select_list ⇒ Object
-
#type ⇒ String
Return the type attribute of the element, or ‘text’ if the attribute is invalid.
Methods inherited from BaseElement
attribute_list, #attribute_value, attributes, #click, #double_click, #driver, #element, #exists?, #fire_event, #flash, #focus, #html, #initialize, #inspect, #parent, #right_click, #run_checkers, #send_keys, #style, #tag_name, #text, typed_attributes, #value, #visible?
Methods included from Container
Methods included from XpathSupport
#element_by_xpath, #elements_by_xpath
Constructor Details
This class inherits a constructor from Watir::BaseElement
Instance Method Details
#enabled? ⇒ Boolean
7 8 9 |
# File 'lib/watir-webdriver/elements/input.rb', line 7 def enabled? !disabled? end |
#to_button ⇒ Object
44 45 46 47 |
# File 'lib/watir-webdriver/elements/input.rb', line 44 def assert_exists Watir::Button.new(@parent, :element, @element) end |
#to_checkbox ⇒ Object
not sure about this
this is mostly useful if you’re using Browser#element_by_xpath, and want to ‘cast’ the returned Input instance to one of the subclasses
34 35 36 37 |
# File 'lib/watir-webdriver/elements/input.rb', line 34 def to_checkbox assert_exists Watir::CheckBox.new(@parent, :element, @element) end |
#to_radio ⇒ Object
39 40 41 42 |
# File 'lib/watir-webdriver/elements/input.rb', line 39 def to_radio assert_exists Watir::Radio.new(@parent, :element, @element) end |
#to_select_list ⇒ Object
49 50 51 52 |
# File 'lib/watir-webdriver/elements/input.rb', line 49 def to_select_list assert_exists Watir::SelectList.new(@parent, :element, @element) end |
#type ⇒ String
Return the type attribute of the element, or ‘text’ if the attribute is invalid. TODO: discuss.
18 19 20 21 22 23 24 25 |
# File 'lib/watir-webdriver/elements/input.rb', line 18 def type assert_exists value = @element.attribute("type").to_s # we return 'text' if the type is invalid # not sure if we really should do this TextFieldLocator::NON_TEXT_TYPES.include?(value) ? value : 'text' end |