Cannot send text to iOS field by using setValue() or sendKeys()

Hello Guys,

I have a problem while I am trying to automate an iOS application which has extra settings in the Settings menu.
When I try to sendKeys in an UIATextField from within the app, there is no problem, the keys are sent. However, when I try to send the text I want in the field, the program hangs and nothing happens.
The workflow is like this:

  • Open application
  • If the app is opened for the first time, you are redirected to the Settings page where you have to fill in 3 text fields. I use the following in order to locate the elements (there are three):

MobileElement Building = (MobileElement) driver.findElements(By.className(“UIATextField”)).get(0);
MobileElement Facility = (MobileElement) driver.findElements(By.className(“UIATextField”)).get(1);
MobileElement MasHost = (MobileElement) driver.findElements(By.className(“UIATextField”)).get(2);
If the fields have a default value, when I get the attribute “value”, the text in the fields is displayed correctly.
If I use the .tap() method, I can see that the cursor blinks (tap is made successfully).
However, when I try to use the .clear() method, .sendKeys() method or .setValue() methods, it seems that the program is stuck.
Any idea on this?

I am using Appium 1.5.2 on MAC
The same problem exists with the older version of appium (1.4.13)
I am using also Xcode simulator for iPhone 6 and iOS 9.3

are you using appium driver or iosdriver ?

I am using iosdriver



// first do tap on needed element
// then do (make sure here that keyboard is opened and visible in emulator! if not disable in Simulator 'Connect Hardware Keyboard')
((IOSDriver) driver).getKeyboard().pressKey("your_text");

It seems that the keyboard is not showing on the screen, I am now trying to find a way to disable the Connect Hardware Keyboard. This is odd because sometimes the keyboard was showing on the screen but now it’s not showing anymore.

"I am now trying to find a way to disable the Connect Hardware Keyboard " - Simulator Menu: Hardware -> Keyboard -> uncheck Connect Hardware Keyboard

1 Like

Ok, done it. I was launching the simulator by running the app so I did not have a Simulator menu. But I’ve managed to open it and disable the Hardware keyboard. I am now able to see the keyboard on screen but still no success in typing the text, the keyboard is opened an no action is made

I’ve also tried it by using:


Still no success… Any more ideas?

so when you do “((IOSDriver) driver).getKeyboard().pressKey(“your_text”);” - you does not see how text typing on keyboard?

Yes, nothing happens. If I type it manually on the simulator keyboard by using the mouse, the text can be typed. But if do it like you told me, nothing happens

I’ve finally managed to resolve my issue. It seems that Appium does not know that the app redirects me to the iOS Settings page. It can read the contents of the field but it cannot fill in the fields. It can only fill them if I go to Settings page first and fill them in from going there first, not redirected from the app. So I guess this is an issue with Appium.

indeed i checked out code and found out that we used another method to send text into settings!

//first find keyboard
WebElement keyboard = driver.findElement(MobileBy.className("UIAKeyboard"));
// now we needed to input numeric chars
// switch to numeric keyboard
keyboard.findElements("more, numbers")).get(0).click()
// now e.g. tap to "0"
1 Like

HI cpopescu,
Can you please tell me how to resolve this issue


Hello, my problem was that I was redirected to the settings screen when I opened up the application. The workaround I am doing is that I first navigate to the Settings, scroll down to the application and set the values I need there. Afterwards I close the Settings and go to the App I am testing.