[iOS] Unable to tap on native TextField

Hi everyone. I’m currently writing tests for iOS native app using Appium 2.5.1
I’m having issues with tapping on a text field and getting a keyboard to show up.

On my Flutter app, click() works like a charm and immediately a keyboard is shown and I can send_keys afterwards.

Note: On simulator apps for both iOS and Flutter app when I manually click on a textfield → native keyboard shows up.

I am trying to find an alternative for my keyboard to show up.

I’ve tried:

  • Every possible selector(xpath, ios-predicate, className etc)

  • Combinations of click(), send_keys, sleep() and clear() to invoke keyboard.

  • Summoning iOS keyboard for appium python with no success

  • Accessibility fields like nativeWebApp**: **true and Simulator → IO → Connect hardware keyboard

My Capability:

{
  "platformName": "iOS",
  "appium:deviceName": "iPhone 14",
  "appium:automationName": "XCUITest",
  "appium:enableMultiWindows": true,
  "appium:app": "/Users/test/test.app",
  "appium:platformVersion": "16.0",
  "appium:udid": "BCB7DF3F-ADE3-0FJKD-8829-E5FD3552A24D",
  "sessionName": "Login",
  "nativeWebTap": true
}

My logs when doing a tap on text field via Appium Inspector:

[XCUITestDriver@cb2f (6fc6f017)] Proxying [POST /session/6fc6f017-0b71-4706-98d7-f36686a3366e/element/0C000000-0000-0000-5E15-000000000000/click] to [POST http://127.0.0.1:8100/session/272F5F22-4130-45B0-9982-6A943563C413/element/0C000000-0000-0000-5E15-000000000000/click] with body: {}
[XCUITestDriver@cb2f (6fc6f017)] Got response with status 200: {“value”:null,“sessionId”:“272F5F22-4130-45B0-9982-6A943563C413”}
[XCUITestDriver@cb2f (6fc6f017)] Replacing sessionId 272F5F22-4130-45B0-9982-6A943563C413 with 6fc6f017-0b71-4706-98d7-f36686a3366e
[HTTP] ← POST /session/6fc6f017-0b71-4706-98d7-f36686a3366e/element/0C000000-0000-0000-5E15-000000000000/click 200 491 ms - 65

Page Source:
Captured stdout:

 <?xml version="1.0" encoding="UTF-8"?>
      <AppiumAUT>
        <XCUIElementTypeApplication type="XCUIElementTypeApplication" name="TEST" label="TEST" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0">
          <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0">
            <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0">
              <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0">
                <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0">
                  <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" accessible="false" x="0" y="0" width="393" height="852" index="0">
                    <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0">
                      <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" accessible="false" x="0" y="0" width="393" height="852" index="0"/>
                    </XCUIElementTypeOther>
                  </XCUIElementTypeOther>
                </XCUIElementTypeOther>
              </XCUIElementTypeOther>
            </XCUIElementTypeOther>
          </XCUIElementTypeWindow>
        </XCUIElementTypeApplication>
      </AppiumAUT>

Is this something that should be fixed by updating iOS app or
is there a workaround in Appium?

Anyone?

It’s not quite clear form the issue description what the expected behaviour is.
By default, though, the xcuitest driver disables the hardware keyboard for better simulator performance. You may change this behaviour by modifying the value of the appium:connectHardwareKeyboard capability

Unfortunately that does not work since iOS simulators ignore that capability since certain version.

If the keyboard is already not shown then I don’t think the capability is ignored, because the default simulator value is to connect/show it.