Check the keyboard is present on the page or not using java

when I do send keys some times the key borad opens some times not. After doing the sendkeys, I have to click on the submit button that is hidden under the keyborad. Since the keyboard appears sometimes I am not not able to click on the button. So I want to check whether the keyboard is present on the page or not using java code. Please help me on the same.

1 Like

Hello, have you tried detect keyboard in any way?
Also for which platform are you writing tests? Android or iOS?

Hey Thank for the reply. I don’t know how to detect the key board.
I am writing the tests on Android.

Hi Degard,

Could you please me as soon as possible…I need to complete some tasks

what you see in uiautomatorviewer? or appium inspector?

I am unable to detect the keyboard from the uiautomatorviewer

Also you can use driver.hideKeyboard(); before tap on Submit button.
If you cant detect keyboard Just wrap hideKeyboard in try catch:

     try {
                driver.hideKeyboard();
                } catch (Exception e) {
                }
1 Like

Hi Dagard,

Thank you so much it worked

1 Like

I tried the same, sometime keyboard is visible, and unable to hide the keyboard via driver.hideKeyboard(); then what step should I follow in catch block to solve above issue.

Unable to detect the keyboard element.

It really worked :slight_smile: Nice