Is it possible to “toggle software keyboard” via the code in UI test?

前端 未结 7 615
时光取名叫无心
时光取名叫无心 2020-12-24 03:25

I have UI tests which testing login functionality (and uses it to test other stuff), but sometimes when focus is changed from one field to another - the keyboard hides, and

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 03:59

    Following Brooks great answer, this will work for all simulators:

    /usr/libexec/PlistBuddy -c "Print :DevicePreferences" ~/Library/Preferences/com.apple.iphonesimulator.plist | perl -lne 'print $1 if /^    (\S*) =/' | while read -r a; do /usr/libexec/PlistBuddy -c "Set :DevicePreferences:$a:ConnectHardwareKeyboard
    false" ~/Library/Preferences/com.apple.iphonesimulator.plist || /usr/libexec/PlistBuddy -c  "Add :DevicePreferences:$a:ConnectHardwareKeyboard
    bool false" ~/Library/Preferences/com.apple.iphonesimulator.plist; done
    

提交回复
热议问题