Can we hide android soft keyboard?

Hi All,

Is there any feature in Appium to hide android soft keyboard while entering data into App Text Fields via running automation script??

Kindly let me know.

Thanks

2 Likes

appium_driver.hide_keyboard

This is in Ruby, but I suspect something similar is available in other supported languages

Java has AppiumDriver.hideKeyboard().

From the Javadocs.

Thank you willosser and afwang, it worked. :smile::smile:
Thanks a ton!!!

Just one more idea:

capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("resetKeyboard", true);

Using this, the soft keyboard will never open during tests. No need to hide it.

19 Likes

Hi Talemo

Thanks for the the another solution. I tried this but Soft keyboard is coming during test.

Kindly look into this.

Thanks

Really? Can you go to device settings -> Language & Input and change default keyboard to Appium Android Input Manager for Unicode and now tap on any EditText field?

For me no keyboard opens. If you do not have that option, then something happened on your test and appium keyboard didn’t get installed.

Hi Talemo

At the very first run it was not working but after 2, 3 run its working, keyboard is suppressed.
I did not changed anything in Language and Input setting, but its working now.

Thanks for the help, it helped me to minimize my code.

:smile::smile:

1 Like

@ravikr42 : I have tried this one : capabilities.setCapability(“unicodeKeyboard”, true);
capabilities.setCapability(“resetKeyboard”, true);
But keyboard is always opening in the app …

Have you tried this?

I didn’t find this one

Hi @emnn_ayadi

For the very first run after setting capabilities you will see the keyboard coming up, but from the second run onward soft keyboard will not come, and internally it sets default keyword as “Appium Android Input Manager” as suggested by Talmo.

Just try running your scripts 2 to 3 times and soft keyword wont come.

Hope this will help.

Thanks
Ravi

@ravikr42 Yes, thank you very much it’s ok now but i have a new problem that i couldn’t find a solution yet !
Sendkeys didn’t work as expected, it sends more than i give to it.
I’m using Appium to write test cases of an Android application, when i tap the following code

 public void EnterQuantity() {
            wd.findElement(By.xpath("//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.ScrollView[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[3]/android.widget.LinearLayout[3]/android.widget.LinearLayout[1]/android.widget.EditText[1]")).sendKeys("1"); 
            }   

I get 11 in Quantity field instead of 1. How can i reduce the speed of writing in order to be sure that only the number i gave is written not doubled.

Hi @Emna

Try using with some sleep time or use explicit wait. I guess it will work , if not please let me know.

Thanks

1 Like

Hi @ravikr42 ,

capabilities.setCapability("newCommandTimeout","60");
wd.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

i’m using this one and i do some thread.sleep(1000); before sendkeys(“1”)
But the problem this error occur not all the time let’s say 70%
In Debug mode it’s working fine .

Hi Emna

can you tell me on which device you are running your scripts?

Thanks
Ravi

Hi Telmo,

I used these two desired capabilities but still the keyboard is appearing in between test and about keyboard setting “Appium Android Input Manager” is not present in the keyboard list.

Please help with your suggestiion.

Thanks in advance!

@vjpatil

For the very first run after setting capabilities you will see the keyboard coming up, but from the second run onward soft keyboard will not come, and internally it sets default keyword as “Appium Android Input Manager”
Just try running your scripts 2 to 3 times and soft keyword wont come.

Thanks.
This code is working for both emulator and real device.

Thanks, this is really helpful.