0
votes

Need to verify keyboard is shown on device screen(android/ios).

Not able to identify keyboard element on screen. So tried using the below method. But its not working.

isKeyboardShown() - it is showing as undefined for the type of appium driver.

using appium version - 7.4.1

        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>7.4.1</version>

Is there any other appium method or way to check this?

3

3 Answers

0
votes

isKeyboardShown is the right way to check it and works on both Android and iOS platform.

In order to use it, you need to properly create an instance of driver (AndroidDriver/iOSDriver):

        driver = new AndroidDriver(appiumURL, capabilities);

        boolean isDisplayed = driver.isKeyboardShown();
0
votes

isKeyboardShown() is the correct way to do it, you just need to cast your driver, in case you are using an AppiumDriver to AndroidDriver or IOSDriver depending on the case, like: ((AndroidDriver)driver).isKeyboardShown();
((IOSDriver)driver).isKeyboardShown();

-2
votes

Try declaring the keyboard container as an element and verify it with isDisplayed()