Problem after hiding the keyboard - Android physical device

Hello,

hopefully someone can help with this problem. Sometimes the driver.hideKeyboard method crashes, I just thought: “ I could catch the exception and I thought I would be fine” (the keyboard is actually dismissed despite the crash).

Instead in some cases (difficult for me to understand when, it seems pretty random) when I get the exception
the keyboard is indeed hidden, but tapping on a button after that fails (“cannot find the element”).
Seems like the driver is trying to click the button on a “higher” coordinate, missing it, as if it thought the keyboard is still shown.

So I tried something like this:

try {
driver.hideKeyboard();
} catch (WebDriverException e) {
log("\n***** Could not hide the keyboard *****\n%s\n\n", e.getMessage());
// Wait for 2 second and force a screen refresh
waitFor(2);
driver.getPageSource(); //force recalculation of the position of the elements in the view?
}

but still no luck. Any suggestion would be much appreciated.

Cheers,
Manuele

You should set your capabilities with this and will stop the keyboard from showing up on your tests.

	"unicodeKeyboard": "true"
3 Likes

That solved our problem, thank you so much, really appreciate that.

Manuele

After doing “unicodeKeyboard”: “true” the total keyboard is hided but I am not able to even manually get the keyboard. How can I revertback so that I can get the manual keyboard in my realdevice.

you have to go to the keyboard option in your device and deselect Appium keyboard

@alangithubtrader Thanks for your reply.

But one small doubt. When I use this way to hidekeyobard I am not able to perform the action like driver.navigate().back(). Is it known issue or another way to work around.