Sha256: 28e9f25585c73a70a55017d753e77ecc8100ea0fa5f4629be50db9b58dae7c32

Contents?: true

Size: 715 Bytes

Versions: 46

Compression:

Stored size: 715 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]

    #
    # 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

46 entries across 46 versions & 2 rubygems

Version Path
watir-6.13.0 lib/watir/elements/button.rb
watir-6.12.0 lib/watir/elements/button.rb
watir-6.11.0 lib/watir/elements/button.rb
watir-6.11.0.beta2 lib/watir/elements/button.rb
watir-6.11.0.beta1 lib/watir/elements/button.rb
watir-6.10.3 lib/watir/elements/button.rb
watir-6.10.2 lib/watir/elements/button.rb
watir-6.10.0 lib/watir/elements/button.rb
watir-6.9.1 lib/watir/elements/button.rb
watir-6.9.0 lib/watir/elements/button.rb
watir-6.8.4 lib/watir/elements/button.rb
watir-6.8.3 lib/watir/elements/button.rb
watir-6.8.2 lib/watir/elements/button.rb
watir-6.8.1 lib/watir/elements/button.rb
watir-6.8.0 lib/watir/elements/button.rb
watir-6.7.3 lib/watir/elements/button.rb
watir-6.7.2 lib/watir/elements/button.rb
watir-6.7.1 lib/watir/elements/button.rb
watir-6.7.0 lib/watir/elements/button.rb
watir-6.6.3 lib/watir/elements/button.rb