By using the following command we can hide the keyboard:
((DeviceActionShortcuts) dr).hideKeyboard();
or
driver.hideKeyboard();
Ref: https://appium.readthedocs.io/en/stable/en/commands/device/keys/hide-keyboard/
2 Likes