Sha256: 9d1758a5ebeb4edc85256c5a7aabaed564c9079193ae01f2792ee83a85e54c33

Contents?: true

Size: 1.08 KB

Versions: 19

Compression:

Stored size: 1.08 KB

Contents

module TestCentricity
  class AppTextField < AppUIElement
    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 = element
      object_not_found_exception(obj)
      !!obj.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 = element
      object_not_found_exception(obj)
      max_length = obj.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 = element
      object_not_found_exception(obj)
      if AppiumConnect.is_webview?
        obj.attribute('placeholder')
      else
        obj.text
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
testcentricity-3.1.1 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.1.0 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.6 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.5 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.4 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.3 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.2 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.1 lib/testcentricity/app_elements/textfield.rb
testcentricity-3.0.0 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.4.3 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.4.2 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.4.1 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.4.0 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.3.19 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.3.18 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.3.17 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.3.16.1 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.3.16 lib/testcentricity/app_elements/textfield.rb
testcentricity-2.3.14 lib/testcentricity/app_elements/textfield.rb