testing - Soft keyboard not present, cannot hide keyboard - Appium android -


i getting following exception:

 org.openqa.selenium.webdriverexception: unknown server-side error occurred while processing command. (original error: soft keyboard not present, cannot hide keyboard) (warning: server did not provide stacktrace information)     command duration or timeout: 368 milliseconds 

i using driver.hidekeyboard() hide soft input keyboard open on screen.
how ensure keyboard open before hiding it? or other workaround?

use adb command check whether keyboard has popped or not

adb shell dumpsys input_method | grep minputshown  output : mshowrequested=true mshowexplicitlyrequested=false mshowforced=false minputshown=true 

if minputshown=true yes software keyboard has popped up. use driver.presskeycode(androidkeycode.back);

one way using java is

process p = runtime.getruntime().exec("adb shell dumpsys input_method | grep minputshown");         bufferedreader   in = new bufferedreader(new inputstreamreader(p.getinputstream()));         string outputtext = "";             while ((outputtext = in.readline()) != null) {                 if(!outputtext.trim().equals("")){                         string keyboardproperties[]=outputtext.split(" ");                         string keyvalue[]=keyboardproperties[keyboardproperties.length-1].split("=");                          string softkeyboardpresensevalue=keyvalue[keyvalue.length-1];                         if(softkeyboardpresensevalue.equalsignorecase("false")){                                 iskeyboardpresent=false;                         }else{                                 iskeyboardpresent=true;                         }                }            }            in.close(); 

ps: please not use driver.navigate().back() behavior may not same on devices.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -