How to dismiss the keyboard in appium using Java?

shiva1791 picture shiva1791 · Apr 22, 2014 · Viewed 26.2k times · Source

This code just aims to find the textbox and send some text to it. When it does that the keyboard appears on the android device.How to dismiss it after the sendKeys.

@Test
    public static void test_demo() throws Exception {
        WebElement element = driver.findElement(By.id("mytextfield"));
        element.sendKeys("test");
        //how do I dismiss keyboard which appears on my android device after sendKeys?  
    }

Answer

Eyal Sooliman picture Eyal Sooliman · Apr 7, 2015

driver.hideKeyboard() will only work with AppiumDriver. I am using java-client-2.2.0.jar that contains this capability.