5

I'm writing UITests that rely on showing the software keyboard. Since the CI launches the tests every time on clean new simulator, the simulator has hardware keyboard connected, hence the software one is not being presented.

Is it possible to set some settings (maybe in schema?) to force-disable connecting hardware keyboard by the simulator.

I am running tests using cucumber/appium.

izik461
  • 1,131
  • 12
  • 32

2 Answers2

0

Actually we faced the issue , the only solution we come up with is to perform "osascript" to run on your code right after the simulator starts .

osascript : basically will check the HW keyboard and if its enabled it will disabled it.

  • Thanks for the suggestion. I've fixed the issue with running this just before starting my tests: 'defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false' – izik461 Jan 29 '19 at 10:54
  • Hi could you please share the script? – ch271828n Jul 04 '22 at 23:02
0

Has anyone figured out how to do this supporting Xcode 10? Using defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false doesn't work.

dwilt
  • 617
  • 9
  • 13
  • Actually this works. We just have to restart the simulator may be by "killall Simulator". Also I tried adding both these commands to a prescript to my ui tests scheme. Works great. Answered it here on a possible duplicate question. https://stackoverflow.com/a/57268609/1590911 – Hasaan Ali Jul 30 '19 at 10:01