Skip to content

hideKeyboard ​

Dismiss the on-screen keyboard if it is visible.

The hideKeyboard command hides the software keyboard if it is visible.

Usage examples ​

The following example hides the keyboard.

yaml
- hideKeyboard

INFO

hideKeyboard does not verify that the keyboard is actually gone, so it never fails the flow. If the keyboard stays open, use the workaround below.

Implementation details ​

Unlike other UI actions, mobile operating systems do not provide a native way for closing the keyboard. To achieve this, Astra Scout simulates the specific gestures or actions a user would perform on each platform:

  • Android: Astra Scout triggers a back button event, which is the standard system-level action to dismiss an active keyboard. This is identical to the back command.
  • iOS: Since iOS does not have a back button, Astra Scout presses the Return key, which dismisses the keyboard in most apps.

Workarounds ​

Because the implementation methods rely on system behaviors rather than direct APIs, they can occasionally be affected by specific app layouts or keyboard types.

If the keyboard doesn't hide, a reliable workaround is to use the tapOn command to click a non-tappable element on the screen (such as a header, a title bar, or an empty background area). This mimics how a user might dismiss the keyboard.

yaml
- tapOn:
    id: "header_title" # Tap on a safe area to force the keyboard down