1

How can i make appium use physical keyboard instead of soft keyboard?

when running a code with xcode no keyboard is shown at all, but with appium the soft keyboard is shown.

i found driver.hideKeyboard() and Dismissing keyboard in appium test on iOS, but they are about how temporary hide keyboard.

The other solution was using Command + K which do the trick, but appium does not do that automatically and if you do that manually when appium starts simulator, test will fail!!

Community
  • 1
  • 1
alizelzele
  • 892
  • 2
  • 19
  • 34
  • If you want to disable the keyboard from showing up every time you perform an action on a TextView, there's got to be changes in the app code made for this. If you instead want the keyboard not to be used, you can `driver.hideKeyboard()` and use `sendKeys()` – Naman May 06 '16 at 06:33

2 Answers2

1

Try the solution as mentioned here by me: Toggle Software Keyboard for entire test suite in appium python

enter image description here

akvenk
  • 466
  • 3
  • 8
  • already tried that, when appium opens the simulator the keyboard come back, likely it kind of reset the simulator (not factory reset since the apps exist) – alizelzele Jun 12 '17 at 09:43
  • does the 'Connect Hardware Keyboard' option stays selected when appium opens the simulator? – akvenk Jun 13 '17 at 14:09
0

You can use sendKeys directly to your desired field. it is independent of keyboard. So i think it will work for you. Example code is below

public void usingSendKey(By by, String text){
        WebElement element = null;
        element = driver.findElement(by);
        try{
            element.clear();
        }
        catch(Exception e){

        }
        element.click();
        element.sendKeys(text);
    }
Mahmud Riad
  • 1,169
  • 1
  • 8
  • 19
  • sendKeys work without any problem. it can even send unicode characters, but that is not the problem; i dont want the keyboard to show up, just like when running code with xcode. – alizelzele May 03 '16 at 05:06