class TestCentricity::AppTextField

Public Class Methods

new(name, parent, locator, context) click to toggle source
Calls superclass method TestCentricity::AppUIElement::new
# File lib/testcentricity/app_elements/textfield.rb, line 3
def initialize(name, parent, locator, context)
  super
  @type = :textfield
end

Public Instance Methods

get_max_length() click to toggle source

Return maxlength character count of a text field.

@return [Integer] @example

max_num_chars = comments_field.get_max_length
# File lib/testcentricity/app_elements/textfield.rb, line 26
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
get_placeholder() click to toggle source

Return placeholder text of a text field.

@return [String] @example

placeholder_message = username_field.get_placeholder
# File lib/testcentricity/app_elements/textfield.rb, line 39
def get_placeholder
  obj = element
  object_not_found_exception(obj)
  if AppiumConnect.is_webview?
    obj.attribute('placeholder')
  else
    obj.text
  end
end
read_only?() click to toggle source

Is text field set to read-only?

@return [Boolean] @example

comments_field.read_only?
# File lib/testcentricity/app_elements/textfield.rb, line 14
def read_only?
  obj = element
  object_not_found_exception(obj)
  !!obj.attribute('readonly')
end