Sha256: 109f7ea1460fb8f4b738dfe063a3e6072f802bea54346365f01c326f7d0a6440

Contents?: true

Size: 1.06 KB

Versions: 36

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

36 entries across 36 versions & 1 rubygems

Version Path
testcentricity_web-2.0.8 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.7 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.6 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.5 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.4 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.3 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.2 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.1 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-2.0.0 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.23 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.22 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.21 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.20 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.19 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.18 lib/testcentricity_web/elements/textfield.rb
testcentricity_web-1.0.17 lib/testcentricity_web/elements/textfield.rb