Method: Appium::Ios#textfield

Defined in:
lib/appium_lib/ios/element/textfield.rb

#textfield(value) ⇒ TextField

Find the first TextField that contains value or by index. Note: Uses XPath If int then the TextField at that index is returned.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/appium_lib/ios/element/textfield.rb', line 42

def textfield(value)
  if value.is_a? Numeric
    index = value
    raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0

    index -= 1 # eles_by_json and _textfields_with_predicate is 0 indexed.
    result = eles_by_json(_textfield_visible)[index]
    raise _no_such_element if result.nil?

    return result
  end

  ele_by_json _textfield_contains_string value
end