Search code examples
iosautomated-testsxcuitest

Does XCUITest type text function send a keyboard input?


Does the XCUITest typetext function actually send a keyboard event through the iOS keyboard or does it simple copy the value provided to it directly into the text box?

I tried to send in Chinese through the typeText Function while the keyboard was of English type, the text box was populated correctly with Chinese characters. But this according to me shows that the typeText function just copies the text given to it to the text box and does not send a keyboard event.

Is my understanding correct?

I have also tried out frameworks like appium but they too internally use typeText provided by XCUITest.

I have also asked this question in the apple dev forum but no replies. Hope the StackOverflow community has an answer :)


Solution

  • For those of you stuck on this problem,

    I found an answer here

    There is a method called app.key['character shown on keyboard'].tap() that taps on the keyboard instead of simply copying the text and pasting it in the text box like typeText function does.