Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to dismiss the keyboard in appium using Java?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.49k
    Comment on it

    When we enter any text in textbox through sendKeys() then after entering the text also the keyboard is not dismissed. If we want to locate the element on the screen then the element could not be located, so to locate the element on screen, the keyboard should be dismissed. Appium provides a method to dismiss the keypad once we have entered the text.

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("platformVersion", "4.4.2");
    capabilities.setCapability("appPackage", "com.whatsapp");
    capabilities.setCapability("appActivity", "com.whatsapp.Main");
    driver = new AndroidDriver(new URL(""), capabilities);
    driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
    WebElement frameLayout = driver.findElement("android:id/action_bar_container"));
    List textView = frameLayout.findElements(By.className("android.widget.TextView"));

    In the above code after entering the text "Kanishka" in the search box, the keyboard is not dismissed and so the menu button cannot be located. .


    We will use the method hideKeyboard() to hide the keyboard after entering the text

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: