Disable Hardware Keyboard for iOS Simulator using UIAutomation

defaults write com.apple.iphonesimulator connecthardwarekeyboard
xcuitest disable hardware keyboard

I'm doing some automated tests in the iOS simulator using UIAutomation.

In Xcode 6, the iOS simulator's keyboard behavior changed to be similar to a real device, and now there is a menu item to connect/disconnect your Mac's keyboard to the simulator: Hardware > Keyboard > Connect Hardware Keyboard.

I don't mind this, but what happens when your Mac's keyboard is connected is that the simulator will no longer show the software keyboard. When you run a test script with UIAutomation, calls like UIATarget.localTarget().frontMostApp().keyboard().typeString("myString"); will fail because the keyboard doesn't appear, even when you've made a text field the first responder.

This is annoying, because if I do any manual testing in the simulator, I will need to remember to disable the hardware keyboard before I run any of my UIAutomation tests, or they will all fail.

Is there any way, from within a UIAutomation JS script, to check hardware keyboard settings and disable them? Or, any way to do this from the command line, prior to executing the UIAutomation script?

If I understood your question correctly, you need bulletproof way to enter text. I just use setValue for that. Like this: UIATarget.localTarget().frontMostApp().textFields().Login.setValue('sofa');

Disable hardware keyboard before running XCUITest on CI · Issue , iOS simulator - disable connect hardware keyboard programmatically Disable Hardware Keyboard for iOS Simulator using UIAutomation When i try this on  Use Xcode Simulator settings to turn off hardware keyboard (Keyboard shortcut COMMAND + SHIFT + K while simulator has focus)") } } } This allows me to sprinkle XCUIApplication.keyboardReadyCheck throughout my tests, which will cause an immediate failure if the hardware keyboard is turned on.

Because Ian's script is not visible in the net anymore , here my variant of the Apple script switching off the hardware keyboard.

tell application "Simulator"
    activate
end tell

tell application "System Events"
    set hwKB to value of attribute "AXMenuItemMarkChar" of menu item "Connect Hardware Keyboard" of menu 1 of menu item "Keyboard" of menu 1 of menu bar item "Hardware" of menu bar 1 of application process "Simulator"
    if ((hwKB as string) is equal to "missing value") then
      do shell script "echo 'hardware keyboard is off'"
    else
      click menu item "Connect Hardware Keyboard" of menu 1 of menu item "Keyboard" of menu 1 of menu bar item "Hardware" of menu bar 1 of application process "Simulator"
    end if
end tell

disable iOS simulator 'connect hardware keyboard , I went through few links but none seems to be helpful. iOS simulator Disable Hardware Keyboard for iOS Simulator using UIAutomation. The snippet below needs to be located in the app target ( not the test bundle) — for instance, in AppDelegate.swift. It will disable any hardware keyboards from automatically connecting by setting any UIKeyboardInputMode 's automaticHardwareLayout properties to nil. 🔥 Does not depend on the settings of the Simulator.

I wrote an AppleScript that sets the state of the hardware keyboard [other versions], which you'd execute like this:

bash$ osascript scripts/set_hardware_keyboard.applescript 0
menu item Connect Hardware Keyboard of menu Keyboard of menu item Keyboard of menu Hardware of menu bar item Hardware of menu bar 1 of application process iOS Simulator
bash$

It's available in Illuminator as target().connectHardwareKeyboard(), so to make sure that the hardware keyboard was disabled before each test run you'd do this in your setup:

automator.setCallbackPrepare(function () {
         target().connectHardwareKeyboard(false);
 });

disable iOS simulator 'connect hardware keyboard , I was asking. Can I set hardware keyboard to off for iOS simulators through a shell script? Disable Hardware Keyboard for iOS Simulator using UIAutomation​. For best results, launch each simulator you wish to use and ensure the following: The soft keyboard is enabled (Command+K in the Simulator app) UIAutomation is enabled in the Developer settings menu; There is not more than one simulator with the same name in Xcode's "Devices" organizer; Real Device Setup

Xcode Swift UI Test - Simulator hardware keyboard - ios, Disable Hardware Keyboard for iOS Simulator using UIAutomation. I'm doing some automated tests in the iOS simulator using UIAutomation. In Xcode 6, the iOS  My problem is that when I click or write something in the iOS textfields the keyboard is not being enabled. This behaviour occurs on Android (I have to get the element and do a click() so the keyboard appears ) but for some reason, on iOS it just doesn't work.

Toggle Software Keyboard for entire test suite in - iOS, All of my test jobs suddenly started failing with this error: “Neither go to (iOS Simulator menu) Hardware > Keyboard > then disable “Connect  Similarly, the Remoted iOS Simulator for Windows treats Windows Stylus input as Apple Pencil input. Sound handling. Sounds played by the simulator will come from the host Mac's speakers. iOS sounds are not heard on the Windows computer. Disabling the Remoted iOS Simulator for Windows. To disable the Remoted iOS Simulator for Windows, navigate to Tools > Options > Xamarin > iOS Settings and uncheck Remote Simulator to Windows.

XCTest / Xcode UI Test, Tricentis Tosca reports in Perfecto · Disable the keyboard auto-hide on iOS Test automation on an iOS device or simulator requires the following components​: software versions and hardware requirements for iOS test automation with the Settings->Developer Settings and switch on the Enable UI Automation option. Disable the Hardware Keyboard. IApp.EnterText will fail if the iOS simulator is configured to use the hardware keyboard. Before running your Xamarin.UITests locally, ensure that the simulator is configured to use the soft keyboard.

Comments
  • Seems fine. Sorry for taking so long to accept this :)
  • What is Illuminator?
  • It was an apache-licensed framework I wrote to do iOS automation back when that was javascript-based. It was later updated to be a Swift library although certain features like the bridge and tagging aren't possible. github.com/paypal/Illuminator