How to use Submit/Enter event after using .sendKeys("String") statement?

Hello Everyone,
I have a login screen of an application

In this screen i have to use enter key of soft keyboard after sending values in it to get access to my account.
How to do that?

Thanks,
Jitender.

Try this

import io.appium.java_client.android.AndroidKeyCode;
_driver.pressKeyCode(AndroidKeyCode.ENTER);

Hello @amitjaincoer191,

driver.pressKeyCode(AndroidKeyCode.ENTER) method is giving some kind of error.

Use int value 66 or hex value ‘0x00000042’
driver.pressKeyCode(66) ;
driver.pressKeyCode(0x00000042);

Actually the pressKeyCode method is not available!

Use java client version 3.2 this method is added in that version.

earlier java client version has similar method sendKeyEvent you can also try that without switching java client version

driver.sendKeyEvent(66) ;
driver.sendKeyEvent(0x00000042);
driver.sendKeyEvent(AndroidKeyCode.ENTER);

http://docs.seleniumhq.org/download/
Here, the latest version is 2.48.2 and i am using.the same version.

with latest 3.3.0 and 3.2.0 java-client jars sendKeyEvent() method is replaced in android with pressKeyCode(int key) and added: pressKeyCode(int key, Integer metastate), longPressKeyCode(int key), longPressKeyCode(int key, Integer metastate)

Hi @jitenderbhardwaj, @auto-geek Can you please let me know that How you resolved the issue?
I m using Java client - 7.4.1 and unable to hit the Keypad Search key

try:

((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.SEARCH));

Hi @Aleksei Thanks for the reply. I m getting the below errors

maybe you need add:

import io.appium.java_client.android.nativekey.AndroidKey;
import io.appium.java_client.android.nativekey.KeyEvent;

Hi Guys, even i am facing the issue if I try to automate the video player controls (play/pause, forward/backward skip icons , maximize/minimize icons). I am getting NoSuchElementException .Please help me.