Sha256: aaacde6891335a145cebb1812b380e782f0c676a1cc4237d25eb863ba02abac9

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

module TestCentricity
  class TextField < UIElement
    def initialize(name, parent, locator, context)
      super
      @type  = :textfield
    end

    # Is text field set to read-only?
    #
    # @return [Boolean]
    # @example
    #   comments_field.read_only?
    #
    def read_only?
      obj, _ = find_element
      object_not_found_exception(obj, nil)
      !!obj.native.attribute('readonly')
    end

    # Return maxlength character count of a text field.
    #
    # @return [Integer]
    # @example
    #   max_num_chars = comments_field.get_max_length
    #
    def get_max_length
      obj, _ = find_element
      object_not_found_exception(obj, nil)
      max_length = obj.native.attribute('maxlength')
      max_length.to_i unless max_length.blank?
    end

    # Return placeholder text of a text field.
    #
    # @return [String]
    # @example
    #   placeholder_message = username_field.get_placeholder
    #
    def get_placeholder
      obj, _ = find_element
      object_not_found_exception(obj, nil)
      obj.native.attribute('placeholder')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
testcentricity_web-1.0.16 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.15 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.14 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.13 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.12 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.11 lib/testcentricity_web/elements/textfield.rb