appium: Desired Capability "connectHardwareKeyboard" not work

The problem

Briefly describe the issue you are experiencing (or the feature you want to see added to Appium). Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask questions. For that, go to http://discuss.appium.io!

Environment

  • Appium version (or git revision) that exhibits the issue: 1.8.1
  • Last Appium version that did not exhibit the issue (if applicable): 1.7.2
  • Desktop OS/version used to run Appium: macOS 10.13.5
  • Node.js version (unless using Appium.app|exe): 10.6.0
  • Mobile platform/version under test: IOS 10.3.1
  • Real device or emulator/simulator: simulator
  • Appium CLI or Appium.app|exe: tested with appium cli and appium desktop 1.6.2

Details

send_keys not work (see logs). “connectHardwareKeyboard”: “False” - not work There is only one way to fix send_keys: uncheck in handly in Simulator -> Hardware -> Keyboard -> Connect Hardware Keyboard But I think “connectHardwareKeyboard”: “False” must work too.

Link to Appium logs

https://gist.github.com/romansvesh/af466277f531715e8628dadf05c2ae61

Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"Keyboard is not present\" UserInfo={NSLocalizedDescription=Keyboard is not present}","sessionId":"44EE4BEB-E7FD-475A-9F70-6305DB7067BB","status":13}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

This stopped working since recent xCode releases. Simulator simply ignores the changed setting from its plist file and applies the default one each time after restart. Closed as third party issue.

It seems ok for me with your concrete use case. Feel free to create a pr to accept an environment variable, too. We’re happy to review it.

But software keyboard still be visible and I cannot switch it off automatically 😦

Yea, it depends on your environment. My last change appium:forceSimulatorSoftwareKeyboardPresence was if appium makes keyboard preference only software keyboard. false means appium does nothing since it seemed the opposite value in WDA did not mean turn software keyboard off.

I don’t know since, but simulators can keep both software keyboard and hardware keyboard on… (Old simulators were able to turn software keyboard off when the hardware keyboard was on.)

Afaik, as jlipps commented, only apple script can change the value via GUI.

You can’t use send keys to simulate key presses on the macOS host. To do what you’d want you should use AppleScript instead.

It seems connectHardwareKeyboard works only when appium launches a simulator since it changes plist. It cannot work dynamically. https://github.com/appium/WebDriverAgent/pull/524 and https://github.com/appium/appium-xcuitest-driver/pull/1327 can avoid turning on the software keyboard preference.