Sha256: af4781e30c4a9e107e752c1c9adfba3294ec066fff15a25916add62ef1e02adb

Contents?: true

Size: 1.2 KB

Versions: 22

Compression:

Stored size: 1.2 KB

Contents

module TestCentricity
  module AppElements
    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
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
testcentricity_mobile-4.1.0 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_apps-4.0.15 lib/testcentricity_apps/app_elements/textfield.rb
testcentricity_mobile-4.0.14 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_apps-4.0.14 lib/testcentricity_apps/app_elements/textfield.rb
testcentricity_mobile-4.0.13 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_apps-4.0.13 lib/testcentricity_apps/app_elements/textfield.rb
testcentricity_mobile-4.0.12 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_apps-4.0.12 lib/testcentricity_apps/app_elements/textfield.rb
testcentricity_mobile-4.0.11 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_apps-4.0.11 lib/testcentricity_apps/app_elements/textfield.rb
testcentricity_mobile-4.0.10 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_apps-4.0.10 lib/testcentricity_apps/app_elements/textfield.rb
testcentricity_mobile-4.0.9 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.8 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.7 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.6 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.5 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.4 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.3 lib/testcentricity_mobile/app_elements/textfield.rb
testcentricity_mobile-4.0.2 lib/testcentricity_mobile/app_elements/textfield.rb