Every time we run appium test for iOS simulator, the device keyboard is in off state, and we have to invoke it manually. Is there any solution that we can invoke it automatically?


#1

Appium - 1.11.1
iOS platform version - 12.1

Every-time when the simulator launches, when we run the test using Appium (as we kill the simulator every-time, once the execution finishes), the device keyboard is in OFF state, so sendKeys won’t work. For that we have to turn the keyboard ON from Hardware > keyboard > (first tick and then untick) Connect hardware keyboard option, manually. But this is not possible to turn on the keyboard every-time manually, when the tests run at night on server. Is there any solution for this, so that device keyboard turns ON automatically when the tests runs from Appium?


#2

I found an answer on the web - you can try using the library called “plistlib” and do:

    import plistlib

    file_name = ('path/to/com.apple.iphonesimulator.plist')
    try:
        p = plistlib.readPlist(file_name)
        p["ConnectHardwareKeyboard"] = "NO"
        plistlib.writePlist(p, file_name)
    except:
        print("Failure")

Let me know if you made it.

Edit: Or you can try to do the same with Java library: https://github.com/3breadt/dd-plist (Just an idea, never did that myself)