This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 7
Aug 2015

simulator only: !driver.findElements(MobileBy.className("UIAKeyboard")).isEmpty();

Can try driver.findElement(By.name("Search")); It will return keyboard button WebElement or will throw NoSuchElementException in case keyboard is not present.

I will go with solution provided by "amedvedev" as class Names are more reliable in iOS. But as said it works only on Simulator.

!driver.findElements(MobileBy.className("UIAKeyboard")).isEmpty();
OR
!driver.findElements(By.className("UIAKeyboard")).isEmpty();

isEmpty() is important other wise method will throw exception and test execution will break.

3 years later

Just on the chance someone comes across this. I’m using ruby but @driverAppium.is_keyboard_shown seems to work fairly well to determine whether the keyboard is visible.