Key Press
Sends a hardware / navigation key such as Back, Home, or Enter.
Purpose
Presses an Android system key: navigation (Back, Home, Recent apps), Enter/Escape, Menu, or the volume keys.
Use it for the actions that have no on-screen button to tap — closing a popup, going back a screen, confirming a field, or returning to the launcher.
When to use it
- Dismissing a popup or dialog reliably (
BACK). - Returning to the launcher (
HOME). - Confirming a text field (
ENTER). - Opening the recent-apps view (
APP_SWITCH).
When not to use it
- To type letters or digits — use Input Text.
- To press an on-screen button — use Click.
Requirements
A connected device. No upstream node needed.
How it runs
- Resolve the key to an Android keycode — a named key like
BACK, or a numeric code. - Dispatch the key press to the device.
- Route Success; the output reports the key sent and its keycode.
An unknown or unsupported key exits Failure.
Settings
| Setting | Type | Range | Default | What it does |
|---|---|---|---|---|
| Key | choice or integer | named key, or 0–288 | — | Required. Which key to press |
| Wait after | integer | 0–60000 ms | — | Pause after the key press |
The named keys
| Key | Effect |
|---|---|
BACK | Back navigation — closes most dialogs and popups |
HOME | Return to the launcher |
ENTER | Confirm / submit |
ESCAPE | Escape |
MENU | Legacy menu key |
APP_SWITCH | Recent-apps view |
VOLUME_UP | Volume up |
VOLUME_DOWN | Volume down |
You may also supply a raw Android keycode between 0 and 288, but prefer the named keys — a wrong raw code either does nothing useful or exits Failure.
Ports
| Port | Taken when | Required |
|---|---|---|
| Success | The key was sent (output: the key and its keycode) | Yes |
| Failure | The key is unsupported or could not be resolved | No |
| Timeout | The input command did not complete in time | No |
| Cancelled | The run was stopped | No — never followed |
| Fatal | The device is disconnected | No — never followed |
Basic example
Close a popup:
- Key:
BACK
Realistic example — a reliable "get back to a known screen" step
Popups are the main source of flakiness in long automation. A short recovery routine that runs before anything important:
Each Back is followed by a settle and a verification rather than another blind Back. The flow gives up cleanly after a bounded number of attempts instead of looping forever.
Saved as a Sub Flow, this becomes a reusable "return to base" function for every other flow.
Advanced example — confirm without a button
Some search fields have no visible submit control:
- Click the field
- Input Text the term
- Key Press
ENTER - Wait, then verify with a detection node
Note that Input Text's Submit after input does the same thing in one node — use the separate Key Press when you need to type first and submit later.
Best practices
BACKis the most reliable popup dismissal available. Prefer it over hunting for close buttons with templates, which vary between dialogs.- Always verify after a navigation key. Back can go one screen further than you intended.
- Bound your Back loops. Two or three attempts with verification, then a clean failure — never an unbounded loop.
- Prefer named keys over raw codes.
- Beware
HOMEin the middle of a flow — it leaves the app entirely, and every subsequent detection will fail until you bring the app back.
Performance notes
- Key Press is among the cheapest nodes: one input dispatch, no frame capture, no analysis.
- The real cost is the settle time and verification you wrap around it.
- A recovery routine that presses Back three times with a 600 ms settle costs about two seconds — well worth it against a flow that dies on an unexpected dialog.
Memory notes
- No frame is captured and nothing is cached. Footprint is negligible.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Using Key Press to type text | Only system keys are sent | Use Input Text |
| Guessing a numeric keycode | Nothing useful, or Failure | Use the named keys |
| Unbounded Back loops | Backs out of the app entirely | Bound the attempts and verify |
| Not verifying after Back | Flow continues on the wrong screen | Add a detection node |
HOME mid-flow | Leaves the app; all detection fails | Only use it deliberately |
Troubleshooting
The key does nothing. Some apps intercept Back. Verify the screen actually changed with a detection node, and fall back to tapping a close button.
The node exits Failure. The key is unsupported or the raw code is outside 0–288. Switch to a named key.
Back closed the whole app. It was pressed on the app's root screen. Verify where you are before pressing Back.
Enter does not submit the form. Not all forms respond to Enter. Tap the submit control with a Click instead.
FAQ
What is the valid raw keycode range? 0–288.
Can I send a key combination? No — one key per node. Chain nodes for sequences.
Does Key Press wait for the screen to change? No. It returns as soon as the key is dispatched. Add a Wait and a verification.
Is BACK the same as the on-screen back arrow?
It is the Android system Back action. Most apps treat them the same, but not all.
Related nodes
- Input Text — typing, and its Submit-after option
- Click — on-screen buttons
- Wait — settle after navigation
- Find Image — verify where you are
Related pages
- Retry and Failures — act, settle, verify