Having trouble with text fields in iOS Simulator 17

It is rather difficult to properly explain what is going on, so I filmed a video.
It is impossible to upload a video here, so I uploaded it to YouTube

But to summarize:
  • Appium doesn’t click or send keys to text fields, if you do not click on a field manually in the iOS simulator.
  • But even when you click on the field yourself, behavior is incorrect. Keys are often being sent to the wrong fields (the cases are shown in details in the video).

Properties from the video:

  • Appium: 2.1.3
  • appium-xcuitest-driver: 5.12.1
  • XCode: 15.1 (15C65)
  • iOS Simulator: 17.0 (21A328)
  • OS: MacOS 14.1.2, Apple M3 Max
  • Python: 3.12.0

Also tried on (the same behavior):

  • Appium: 2.2.3, 2.3.0
  • appium-xcuitest-driver: 5.2.0; 5.12.2
  • iOS Simulator: 17.0.1, 17.2

On my old laptop (MacBook '2019 on Intel Chip) everything worked fine. I can’t check which versions were installed there, but I set these tests there ~2 months ago, so it was also very close to the latest.
But now on the M3 chip the behavior is very strange, and I didn’t manage to localize the problem by upgrading/downgrading everything I could. So it looks like some crazy compatibility problem.

Please, help me understand what is going on.

UPD: interesting update: I have just run the test on BrowserStack (the test code itself is still located on my local machine), and I got EXACTLY the same behavior there: text fields are not being filled with text. So I don’t think it is related to the upgrade from Intel to M3 anymore. But I still have no idea what is going on.

send keys more slowly with delays?

Hi, Conrad. It is not about delays.
As you can see from the video, the problems are not only with not sending keys, but also with clicks, and with sending keys successfully, but to the wrong elements.

Originally I tried to send keys char-by-char, it doesn’t change the behavior.

I’ve seen problems before when some chars are missing, if you pass the whole string into send_keys at once. This is obviously something different.

this is the most detailed defect demonstration clip ever - I am seeing that when you send a click to the element it actually is not setting focus to the element? Is that right?
Does this reproduce if you use a real phone? (I’ve never used the simulator successfully myself.)

“this is the most detailed defect demonstration clip ever” - thanks! Well, the more detailed it will be, the more chances I have to get help :slight_smile:

“I am seeing that when you send a click to the element it actually is not setting focus to the element? Is that right?” - yes, that is one of the parts of the problem.

“Does this reproduce if you use a real phone?” - I don’t have an IPhone, but I believe it doesn’t: if you look at 2:33 in my video, then you could see, that even in the simulator a real mouse click works fine. But not the Appium click.

(I used to use the simulator intermittently a long time ago, back when the simulator was just painfully slow. It’s much faster on the nice new macs now though. But, we added some new product features and the simulators for iOS and Android no longer support quite a few of our test cases sadly.)

Does look like one of the appium gurus needs to watch your clip. Here’s hopeing they do.

Do you know if it is possible to ping someone here who could possibly help? The problem still blocks me, but maybe it is just something simple I am doing wrong.

This is often happens, all depends how app written.

Did you try send text with actions instead of to element?

Also share page source of your app screen and code how you find text inputs to undersrand better issue.

1 Like
  1. As I said before and shown in the video, the problem is not only in send_keys. It is in the clicking itself also: click() also doesn’t work.

  2. ActionChains doesn’t change the behavior: after running

from appium.webdriver import WebElement
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver import ActionChains

doctor_username: WebElement = self._driver.find_element(AppiumBy.XPATH, "//XCUIElementTypeTextField[@name='login.textField.doctorUsername']")

nothing happens in the app (as in the initial video example): there is no click, the keys are not sent. Appium logs:
Appium actions approach logs.txt (15.0 KB)

  1. I am not allowed to share the full application source code, but the fields are initialized in this manner:
  • Username:
       viewModel.editingChanged ? "" : viewModel.placeholder,
       text: $viewModel.text.animation(.easeInOut)
  • Password:
       viewModel.editingChanged ? "" : viewModel.placeholder,
       text: $viewModel.text.animation(.easeInOut)

where TextField and SecureField are standard SwiftUI entities.
I can share some other pieces, but I need to know, which ones.
I also remind that the problem is not only for the secured (password) field, it is there for all the fields.

  1. I don’t think that the problem is with the fields initialization, because, as I’ve said in the description, the test worked a couple of months ago on my old laptop, and the initialization of the fields of the view or the view itself haven’t change since then (the test hasn’t changed also).
    At the same time, compatibility issues on my current laptop would be strange, because behavior in BrowserStack is exactly the same as on my laptop: incorrect. So I am quite confused.
    Unfortunately, when I had my old laptop, BrowserStack runs were not set up yet, so it is not possible to track when and why exactly everything stopped working.

you have 2 inputs on screen. May you pls use another search - NOT XPATH?

// Java
        WebElement usernameInput = driver.findElement(AppiumBy.className("XCUIElementTypeTextField"));
        WebElement passcodeInput = driver.findElement(AppiumBy.className("XCUIElementTypeSecureTextField"));


username: WebElement = self._driver.find_element(
# AppiumBy.XPATH,
# “//XCUIElementTypeTextField[@name=‘login.textField.doctorUsername’]”)



<appium.webdriver.webelement.WebElement (session=“ca9e04ad-f38a-4e87-bb1c-cdb7ec3e02e5”, element=“13000000-0000-0000-869C-000000000000”)>

No changes in the behavior, the app doesn’t respond to click and send_keys commands from Appium.

UPD: also tried your option with class names - the result is the same.

Share page source…

1 Like

@kshumanev Just an assumption from my side but still, do you have accessibilitylabel set in the source code for your username/password fields?

Also what should help is simply getting the coordinates of an input field and perform click by those coordinates using Actions so as a result the input become focused and you will be able to input the value

So after some communication with some of the iOS developers from another team, it was found out, that the problem can be solved by changing padding to 0 in a TextField struct. The code in our case is the following:


var body: some View {
            .font(.roboto(.regular, size: configuration.fontSize))


var body: some View {
            .font(.roboto(.regular, size: configuration.fontSize))

I am not an iOS developer, and I don’t really know why it has such an affect, but I hope it helps other people having a similar problem. If we get more insights, I will update the answer.