How to hidekeyboard in ios

How to hide keyboard in ios,i try some way to do this,but failed
I try to ignore the keyboard to click the btn below the keyboard , the element be found by presenceOfElementLocated ,even the element not null, but still click failed ,so how to deal with it.
For help!

You can use “driver.hideKeyboard();” to hide the keyboard.

driver.hideKeyboard() does not work everytime. You need to handle it maually either with extra step in your cases to hide keyboard i.i by clicking some outer element of screen to hide keyboard.

try to create a method to click on return or done button

How ?

public void hideKeyboard(){
private List done = driver.findElements(“done”));
private List return= driver.findElements(“return”));
} else if (return.size()!=0){

and call this method once you need to hide keyboard

but if the keyboard is a numberic without any done or return

in this case you have to do 1 of 2 options

1- Click on empty area by using X,Y click
2- Click on field after this field

But, when i have the same situation i prefer to start with form from bottom, in this way you can access all elements and no need to hide keyboard
could you please try it ? :slight_smile:

Yes @jiahan.tang that’s why to prevent cases from failure make a click to outer element on screen.