This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
12 / 12
Feb 2017

How to go back or hide the keyboard after typing in one text field On iOS ?? I tried using driver.hideKeyboard() but doesn't works with Appium 1.2.1 Please help

  • created

    Sep '14
  • last reply

    Feb '17
  • 11

    replies

  • 11.2k

    views

  • 7

    users

  • 4

    likes

  • 7

    links

2 months later

@Nischal_Sinha @Telmo_Cardoso

Neither of methods hideKeyboard or hide_Keyboard are working as getting below error

for # (NoMethodError)

But as per documentation on https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md175

Where do you refer to , in order to find correct method name ?

I'm using Ruby

Thanks,
Vikram

@Telmo_Cardoso

sorry my bad , I need to wait for keyboard to first appear and then call this method, also I did mistake with method name as well.

do you have any sample project with ruby on github ( with common actions on android / iOS ) which I can refer to for learning good practices ?

Thanks again.

Regards,
Vikram

1 month later
20 days later

Hi,
I am using Cucumber+Page-Object+Appium and this is the script :
caps = { :browserName => browser_name, :platform => "Android" }
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 500
@browser = Selenium::WebDriver.for(:remote, :url => "http://localhost:4723/wd/hub/", :http_client => client, :desired_capabilities => caps)
I need to hide/close the Android device key-pad due to which some cases are failing.
How to do it in ruby. Kindly help me out.

2 years later

using hide keyboard method is available in Android driver.
driver.hideKeyboard();

its working fine when keypad is in enable state some times the keypad in not in enable
it gives error...

I just dont bother too see if its open or not :slight_smile:

public static void hideKeyboard(AppiumDriver driver) throws Exception {
    try {
        driver.hideKeyboard();
    } catch (Exception e) {
        //Lets ignore, apparently its throwing exception when keyboard was not opened
    }
}

But if you really need it, check @auto-geek answer in here (I tried it and it works perfectly):

minor correction:

public void hideKeyboard_Android(AppiumDriver driver) {
    if (((AndroidDriver) driver).isKeyboardShown()) {
        try {driver.hideKeyboard();} catch (Exception e) {}
    }
}