Skip to content

press_key

Kelly Ferrone edited this page Sep 10, 2026 · 4 revisions

press_key

Press a named key, at an element or wherever focus currently is.

MCP tool press_key
HTTP POST /browser/press-key

For Tab, Escape, Enter, arrows and similar. Known keys: add, alt, arrow_down, arrow_left, arrow_right, arrow_up, back_space, backspace, cancel, clear, command, control, decimal, delete, divide, down, end, enter, equals, escape, f1, f10, f11, f12, f2, f3, f4, f5, f6, f7, f8, f9, help, home, insert, left, left_alt, left_command, left_control, left_meta, left_option, left_shift, meta, multiply, null, numpad0, numpad1, numpad2, numpad3, numpad4, numpad5, numpad6, numpad7, numpad8, numpad9, page_down, page_up, pause, return, right, right_alt, right_control, right_meta, right_option, right_shift, semicolon, separator, shift, space, subtract, tab, up, zenkaku_hankaku.

Not a reliable way to scroll - page_down only moves the page when focus happens to be on the scrollable container. Use execute_script to scroll.

Parameters

Name Type Required Default Notes
key string yes
session_id string yes over HTTP The session_id returned by /browser/open. Required here.
xpath string no
url string no
wait_timeout integer no 30

Returns

Field Type Notes
key string The key that was sent.
url string Current URL after the action.
title string Page title after the action.

Errors are 400 for a bad argument, 401 without a token, 500 when the Grid refuses. Over MCP the same failures arrive as a tool error.

Example

MCP

press_key(key="…")

HTTP

curl -X POST $SELENIUM_FLOW/browser/press-key \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "session_id": "…",
    "key": "…"
  }'

← All actions · Installing · Deployment

Clone this wiki locally