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

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!

  • created

    Nov '18
  • last reply

    Nov '18
  • 6

    replies

  • 172

    views

  • 4

    users

  • 1

    link

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(By.id(“done”));
private List return= driver.findElements(By.id(“return”));
if(done.size()!=0){
done.get(0).click();
} else if (return.size()!=0){
return.get(0).click();
}
}

and call this method once you need to hide keyboard

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: