0

I see AndroidDriver hierarchy as below.

AndroidDriver -> AppiumDriver -> DefaultGenericMobileDriver -> MobileDriver -> HidesKeyboard

Using appium java-client 7.2.0 version.

HidesKeyboard interface has implemented hideKeyboard() method. The method is not available, when I am trying with object of AndroidDriver.

enter image description here

I want the below code to work. Any clues?

AndroidDriver<AndroidElement> androidDriver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
androidDriver.hideKeyboard();

As per the official documentation, hideKeyboard() method should be accessible.

http://appium.io/docs/en/commands/device/keys/hide-keyboard/

enter image description here

Sandeep Nalla
  • 173
  • 2
  • 15
  • What of the appium version? – frianH Oct 02 '19 at 04:25
  • Using appium java-client 7.2.0 version. – Sandeep Nalla Oct 03 '19 at 08:08
  • This is maven project? if yes, I suspect you have selenium dependencies, try remove it. Maybe it conflict with your `java-client`, and it seems like your question too broad, please provide more information for this question. – frianH Oct 03 '19 at 12:38
  • By the way you can use `driver.navigate().back();` if you want close keyboard, when keyboard is open it will do back action and it will close the keyboard. – frianH Oct 03 '19 at 12:42
  • Per the documentation at https://stackoverflow.com/questions/23220067/how-to-dismiss-the-keyboard-in-appium-using-java, the said solution works for only old version of appium. Can you please let me know why the hideKeyboard() method is not accessible? – Sandeep Nalla Oct 04 '19 at 06:52

1 Answers1

0

If you want to hide your keyBoard during the whole tests, use this:

caps.setCapability("unicodeKeyboard", true);
caps.setCapability("resetKeyboard", true);
Vault23
  • 743
  • 1
  • 5
  • 19
  • Yes, this works out if keyboard is to be hidden for the whole test. I am curious why the hideKeyboard() method is not available. – Sandeep Nalla Oct 03 '19 at 08:11