Close the keyboard on iOS

By default, the onscreen keyboard in native iOS applications is set to auto-hide. That means the keyboard only appears during the interaction with a TextBox and is automatically hidden after you enter a text value. On iPhone devices, this may have an impact on the performance of the TextBox automation.

To turn off the auto-hide mode in native apps, you can use the Set Autohide Keyboard Module. If the keyboard stays visible, set the Steering Parameters in the textbox attribute properties. In this article, you can find details about the keyboard close parameters and how to use them.

Prerequisites

The table below lists all parameters that you can use on mobile controls to close the iOS keyboard.

Keyboard hide parameter

Description

KeyboardDismissalReturn

Add this parameter to specify if the Return key is sent to the keyboard or not.

KeyboardDismissalButton

Add this parameter to specify a dismissal button from your keyboard by entering its name and index.

KeyboardDismissalClick

Add this parameter to specify the value of the location where you want to click on the mobile device's screen.

KeyboardDismissalSwipe

Add this parameter to specify the starting and ending points for the swipe action.

KeyboardDismissalSwipeDuration

Add this parameter to refine the KeyboardDismissalSwipe to specify the speed of the swipe needed to dismiss the keyboard.

 

To close the keyboard during test execution, follow the steps below:

  1. Access your project. Note that you should have either the Open Mobile App TestStep or the OpenUrl TestStep as a first TestStep.

  2. In the Properties section, create a new steering parameter.

  3. Define the keyboard hide parameter you want to use.

  4. In the Value column, specify the outcome behavior.

  5. Set the ActionMode to Input.