1

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 :)

jainil
  • 41
  • 10

1 Answers1

2

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.

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
jainil
  • 41
  • 10
  • Rad! typeText became incredibly slow for me in Xcode 13 so I've moved to copy + paste, but that's flaky (built in my own redundancy, but quite the hack)... May have to investigate tapping keys one by one. – Mike Collins Feb 14 '22 at 21:14