How to hide keyboard in iOS mobile automation using Appium

Sorry for the late reply.
Yes, capabilities.setCapability(“unicodeKeyboard”, true); is deprecated now.
I’ve deleted it from my code, but when I’m testing on Android devices even without that capability, keyboard is not displayed on the phone screen.
If keyboard is somehow displayed, please follow my iOS solution and just define new element selectors related to the Android device.

@Telmo_Cardoso @mykola-mokhnach @Aleksei @d_panich Hi guys, there is an easier way to hide the keyboard in IOS instead of tapping outside or buttons like “Go”, “Next”, “Done” or any other complex logic.

Just do the following:

inputFieldElement.sendKeys("my cool text input" + "\n");

In my opinion, it is the fastest, most stable, and easiest way to hide the keyboard, never experienced any issues with this approach in my tests.

1 Like

This all depends how our app inputs coded. \n means as you wrote Go/Next/Done but it may not work or you do not want take action “Go”. Often needed just hide keyboard.

@Arsen_Domanych Thank you, I’ll have that on mind.
This solution looks very good and interesting

Currently I can’t use this solution because our tests are executed on Android and on iOS app. So, we’ve to make our code common for both platforms. In this case I’d recommend using method for hiding keyboard step by step :slight_smile: