@UD 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!
driver.pressKeyCode(66); //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:((AndroidDriver)driver).pressKeyCode(66);
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.
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
With 6.1.0, use this way to press a particular key :
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.ENTER));
On using ((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.ENTER));
pressKey gives error:
The method pressKey(io.appium.java_client.android.nativekey.KeyEvent) in the type PressesKey is not applicable for the arguments (java.awt.event.KeyEvent)
2 quick fixes available:
Change to longPressKey()
Change to pressKeyCode()
(new KeyEvent(AndroidKey.ENTER) gives error: The constructor KeyEvent(AndroidKey) is undefined
KeyEvent is striked.
On changing pressKey to pressKeyCode, I’m getting error: The method pressKeyCode(int) in the type PressesKey is not applicable for the arguments (KeyEvent)
You have included wrong import ‘KeyEvent’.
Remove : import java.awt.event.KeyEvent;
Add these import only :
I tried with
It worked for me. Hope it helps you for Android Keyboard Events.
Constant Value: 66
@harshitj, @Sankar_G : Thanks for your inputs.
Presently I have some other business related roadblock, so I’ll update you after some days on what is working.
Thanks a lot! It helps me!
it worked…, really cool… thanks
Nice, work like a charm. thak you