Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dismiss the keyboard in appium using Java?

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?  
    }
like image 652
shiva1791 Avatar asked Apr 22 '14 12:04

shiva1791


3 Answers

Add these desired capabilities values if you want to disable the keyboard on your android selenium tests.

capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("resetKeyboard", true);
like image 75
SOAlgorithm Avatar answered Nov 17 '22 03:11

SOAlgorithm


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

like image 42
Eyal Sooliman Avatar answered Nov 17 '22 05:11

Eyal Sooliman


Best way is to use the back button.

driver.navigate().back(); // For older version of appium
like image 8
user2220762 Avatar answered Nov 17 '22 03:11

user2220762