How to handle native android keyboard using appium

Any help would be appropriated

I need to click or tap on Go/Done button on android s3 device which running 4.3 version

I tried all sorts of option

  1. driver.pressKeyEvent(66) or driver.pressKeyEvent(AndroidKeyCode.ENTER)
  2. Driver.sendKeyEvent(66)
  3. driver.execute(“mobile:keyevent”, “keycode:66”);

I manage to click on all keys except Go/Done button

Appium version - 1.4.13
Java 1.7 appium
Maven - 3.2.0

Can you try sending the key event via adb??

For the Next/Go/Done combination, I use
adb shell input keyevent ‘KEYCODE_TAB’

Hope this helps

1 Like

Thanks Guys for your reply

I tried on my app it does’t work

But, I tried with other apps which are installed on my device

I used command “adb shell input keyevent KEYCODE_ENTER”… It worked

So problem might to with in my app, may be some key event listners are not implemented i think,

@rakesh Are you using below capability ?
capabilities.setCapability("unicodeKeyboard", true);
If not can you try with this capability.

1 Like


capabilities.setCapability(“unicodeKeyboard”, true) did’t worked for me

I asked my developer to add a lister called “OnKeyListener”

finally worked…

refer to this Unable to tap 'search' button on Android softKeyboard
@praveentp009 explained in detail

thanks @praveen

hello rakesh,
please send me your test script

Except what rakesh said in the above thread(as i cannot force developer to write extra code and developers are not accessible for me)

I tried all the ways specified in this thread, but didnt help. Can someone help me here?

element.sendKeys(strValue+"\n"); - entering the value but soon after navigating to home screen.

String command = “adb -s input keyevent KEYCODE_SEARCH”;
** try {**
** Process result = Runtime.getRuntime().exec(command);**
** } catch (IOException e) {**
** // TODO Auto-generated catch block**
** e.printStackTrace();**
** }**
enter the value but didnt click on Search button.

Enter the value and bringing back to home screen.

Also tried with Keyevent codes 84 and 66, but didnt help.

Can someone let me know any other soluctions


i tried all solution nothing worked for me… i have wasted lots of time trying to find solution without approaching developers, but i did’t do any progress …

my suggestion is ask you develop to add click Listers then it should work


Ohhhhh… the problem for me is, the app developers are 3rd party vendors and we dont have any access to approach them.

have you been able to get this problem solved?

@UD the only workaround that I found is to use a third party keyboard (GO Keyboard works for me) and then send key event 66. Works as expected. Maybe if you reverse engineer GO Keyboard implementation you can get more insight on how to make it work without a third party keyboard. Cheers!

1 Like

//This is to press “Enter” from keyboard

The driver.pressKeyCode(66); method doesn’t work for me. The only other solution I have seen is to tap the button based on coordinates. Although it would work it would be awful when trying to support multiple devices.

Has there been any progress on this topic? This feature is fairly critical for the work that I am doing. If anyone has a solution to this it would be greatly appreciated.

Hello, Did you have added jars of java client jar and android jar?

guys i want to add that Appium driver now has key press code in its API

How can we handle enter key on custom numeric keyboard in Android?

You can try it for maven project:

I am using Python 3.6 + Appium V1.6.5
Try the following:

Set the following two lines to your desired_caps.
desired_caps[‘unicodeKeyboard’] = True
desired_caps[‘resetKeyboard’] = True

Then use keycode 66. it works for me.

I’m using:
io.appium -> 6.1.0
selenium -> 3.13.0
guava -> 24.0-jre

When I use : ((AndroidDriver)driver).pressKeyCode(67);
I get the following error message with pressKeyCode instruction striked-on : The method pressKeyCode(int) from the type PressesKey is deprecated