Class: Watir::Button
- Inherits:
-
HTMLElement
- Object
- BaseElement
- HTMLElement
- Watir::Button
- Defined in:
- lib/watir-webdriver/elements/button.rb,
lib/watir-webdriver/elements/generated.rb
Overview
Class representing button elements.
This class covers both <button> and <input type=“submit|reset|image|button” /> elements.
Constant Summary
Constants inherited from BaseElement
Watir::BaseElement::IGNORED_ATTRIBUTES
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Returns true if this element is enabled.
-
#text ⇒ Object
Returns the text of the button.
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, 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
Returns true if this element is enabled
40 41 42 |
# File 'lib/watir-webdriver/elements/button.rb', line 40 def enabled? !disabled? end |
#text ⇒ Object
Returns the text of the button.
For input elements, returns the “value” attribute. For button elements, returns the inner text.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/watir-webdriver/elements/button.rb', line 22 def text assert_exists case @element.tag_name when 'input' value when 'button' text else raise Exception::Error, "unknown tag name for button: #{@element.tag_name}" end end |