We use appium<1.2.4> with java/node, we need to click on soft keyboards "Done" Action. is there any way to achive this?

Hi Team,

We are using Appium current version(1.2.4) and I need your help to press “Done” Button in android soft key.

Is there is any way ?

If Yes please let me know.we are using java and NODE.

Thanks in Advance.

I see, you’ve tried this solution.
Within what context are you trying to hit button?

Just curious, why do you need to hit ‘Done’ button?
You can navigate back, you can hide keyboard with built-in method.

Just tried hide_keyboard method and got this:

Selenium::WebDriver::Error::UnknownError Exception: ERROR running Appium command: Object [object Object] has no method 'hideKeyboard'

Filed issue: https://github.com/appium/appium/issues/4012

Thanks kirill

But in My App for saving data I have to use Done button only.

Yes same issue i am facing but mention solution is not working for me

please could you help me or provide me code in java so i can press Done button in my app.

1 Like

Well, I can write Java code using UIAutomator to press ‘Done’ button, but first, try to send ‘Enter’ key to your driver.

Actions builder = new Actions(driver);
builder.keyDown(Keys.ENTER).perform();

Or

import org.openqa.selenium.Keys

driver.findElement(By.xpath("*")).sendKeys(Keys.RETURN);

Getting Exception

“Key Down / Up events only make sense for modifier keys.”

Any other solution ?

Have you tried clicking on the Done button?
Use the inspector to find the xpath and then click on it.

AppiumDriver.sendKeyEvent(4) would do.

Hi Neto,

I am talking for Soft(Key Board) Android “Done” Key.

I think so it is not possible to find any android key with Xpath.

Hi Mitsram,

I checked with 4,6,16,66 but again bad luck it is not working.

Thanks for reply.

Team any another solution please.

Aarrgg sorry, I thought it will be the same than iOS

so was the solution found? I am facing the same issue. Where I need to click/press ‘done’ in order
to save the text-field data.
thx

No. keyDown() only works on Keys.SHIFT, Keys.ALT and Keys.CONTROL.
If the provided key is none of those, IllegalArgumentException is thrown.

refer to: http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/interactions/Actions.html#keyDown-org.openqa.selenium.Keys-

@Khan_Imran did you find any solution to this problem?
I am also facing this…

I have a temporary solution, in which I’ll update this comment once I manage to find a better solution because my app quits unexpectedly afterwards but I think it’s the app’s problem, not my solution.
Adding “\n” at the end of the String in sendKeys seems to work.
webElement.sendKeys(myString+"\n");

Any on found any solution for clicking on DONE button on android i tried all above mentioned, no luck

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

Environments
Appium version - 1.4.13
Java 1.7 appium
Maven dependency - 3.2.0

For time being i use coordinates and continuing my work, but definitely it will fail if i connected different devices

@rakesh have you been able to update to any other solution till now?

Hello, in my case, i’ve tested everything out but nothing worked, i finally manage to get it work using the following code:

Dimension dimensions = driver.manage().window().getSize(); 

// Assumes that the button “done” of the keyboard is always in the bottom right corner of the screen
int x=dimensions.getWidth()-5;
int y=dimensions.getHeight()-5;
StringBuilder sb=new StringBuilder();
sb.append("adb shell input tap “).append(x).append(” ").append(y);
Process result = Runtime.getRuntime().exec(sb.toString());

This code is to be used only when there is no other “clean” solution

Hope it helps