class Watir::Button

Class representing button elements.

This class covers both <button> and <input type=“submit|reset|image|button” /> elements.

Constants

VALID_TYPES

Public Instance Methods

text() click to toggle source

Returns the text of the button.

For input elements, returns the “value” attribute. For button elements, returns the inner text.

@return [String]

Calls superclass method
# File lib/watir-webdriver/elements/button.rb, line 24
def text
  tn = tag_name

  case tn
  when 'input'
    value
  when 'button'
    super
  else
    raise Exception::Error, "unknown tag name for button: #{tn}"
  end
end