When I want to hide the keyboard, (because if I don't hide it when I click into a button under keyboard a number from keyboard is pressed instead of the confirm button for example) some times it's hidden ok by the command driver.hidekeyboard();
and other times it's hidden automatically.
Other times it tells me
An unknown server-side error occurred while processing the command. (Original error: Soft keyboard not present, cannot hide keyboard)
Use adb command to check whether keyboard has popped up or not
adb shell dumpsys input_method | grep mInputShown
Output : mShowRequested=true mShowExplicitlyRequested=false mShowForced=false mInputShown=true
if mInputShown=true
then yes software keyboard has popped up.
Then use driver.pressKeyCode(AndroidKeyCode.BACK);
PS: Please do not use driver.navigate().back()
as its behavior may not be same on all devices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With