Trying to click enter on android keyboard


My tests run under browserstack with appium 1.20.2 and wdio 7.7.3 using javascript.
I need to click on enter in the mobile (android) keyboard after entering a text in a field to go to another page.

I tried this:


But nothing happened. I only see the cursor moving inside the field that’s all.
Just to precise the keyboard isn’t shown while the tests are running I don’t know if it’s the reason why nothing happened.

Can anyone help me please?

Thank you

  1. try enter test like:
String email = "[email protected]\n"
  1. try tap before into input to appear keyboard and then enter text + tap enter key

Try on this field instead

Thank you for your answer.
Here is what I did:

  1.   driver.pressKeyCode(66); in the field
  2.   setValue("[email protected]\n");
  3.   driver.pressKeyCode(66);

I ve found myself clicking on the Facebook button and the keyboard hasn t shown :frowning:

I tried this
driver.execute(‘mobile: performEditorAction’, {‘action’: ‘done’});

It hasn t worked :frowning:

add more details.

  1. you tap on input.
    1.1 Does keyboard appear?
    1.2 Does cursor start blinking in input?
  2. What last button have keyboard? Done, Enter, Next?
  3. After you enter text what happens? Keyboard hiding or you trying to hide it?

1.1 No the keyboard doesn’t appear at all
1.2 Yes the cursor starts blinking

  1. The button is “Done”

  2. The keyboard doesn’t appear at all and I am not trying to hide it.

so make keyboard to appear with tap on input first and then repeat all tries.

The keyboard doesn’t appear even when I tap. :frowning:
Do you know how to show it? or if there is something to add in the config file please?

if you tap manually keyboard appears? If - it is = you tap in wrong place.

Manually I see the keyboard yes. When I tap the email I directly click at the Done button.
Automatically, I tried :

  • to tap on the field by doing a click on it and then write the email and driver.pressKeyCode(66);
  • to driver.pressKeyCode(66); on the field and write the email and driver.pressKeyCode(66); again
  • I tried the same thing but with driver.execute(‘mobile: performEditorAction’, {‘action’: ‘done’});
  • And another time with adding a “\n” at the end of the mail address.

Is the keyboard shown automatically in your project? Could it be an appium issue? I am using the 1.20.2 version.

no no. first step we need keyboard to appear. you need tap on input. you have at least following ways:

  1. wrong in most cases as click is WEB while on phone we have tap.
  2. tap on element using TouchAction ->
  3. tap on element using W3C action (it should be preferably way!) -
  4. when tap does not work by ANY reason we can always use tap by coordinates that should work 100% on any phone.
  5. if you are with Android phone enable in Developer menu option to show touches - greatly helps to see where tap/click actually happens.

Hello again :slight_smile:

Here is what happens when I tap on the input element:

await browser.touchAction({
action: ‘tap’,
x: 84, y: 485, //position of my input element

I also tried this:
{ action: ‘tap’, options: { x: 84, y: 485}}


Same result. (I got the x and y by doing a getLocation)

My tests should run on browserstack.

No luck…
Try add capability ‘autoWebview’. Your screen is webView. Try to work with it directy.

It’s not a webview, it’s a native app


I finally did it :partying_face:
I just had ti use this command driver.execute('mobile: performEditorAction', {'action': 'Done'});

Thank you for your help :slight_smile:

ahhhh it was misprinted!