Usage of keyboard in mobile testing

You can try using ‘adb’ command. Refer here: https://www.raizlabs.com/dev/2017/09/automating-input-events-android/. Basically this adb command can be called directly from either cmd (Windows) or terminal(macOS) and so in your script just create a util served as wrapper to call the command, e.g: http://blogs.sheelapps.com/2013/03/run-system-command-in-groovy.html