Sha256: c4be9a0aaa0199833d3beb8ebf5a26193b11bad9a26e1651971671d48af28e34

Contents?: true

Size: 594 Bytes

Versions: 4

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

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 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
      tag_name == 'input' ? value : super
    end
  end # Button
end # Watir

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-7.3.0 lib/watir/elements/button.rb
watir-7.2.2 lib/watir/elements/button.rb
watir-7.2.1 lib/watir/elements/button.rb
watir-7.2.0 lib/watir/elements/button.rb