Sha256: f9538d16b615d3321b6b9c8768cf84bd615ee9875d4c12b7b128b6b59b3a6749

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

module Watir
  #
  # Class representing button elements.
  #
  # This class covers both <button> and <input type="submit|reset|image|button" /> elements.
  #

  class Button < HTMLElement
    inherit_attributes_from Watir::Input

    VALID_TYPES = %w[button reset submit image].freeze

    #
    # Returns the text of the button.
    #
    # For input elements, returns the "value" attribute.
    # For button elements, returns the inner text.
    #
    # @return [String]
    #

    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
  end # Button
end # Watir

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-6.14.0 lib/watir/elements/button.rb