utils/flutter_web_drive/keys.py
Krzysztof kuhy Rudnicki f93a24e283 flutter_web_drive: headless CDP driver + MCP server for Flutter web apps
Drives a Flutter web build in a persistent headless chromium (systemd-run
unit, own profile, CDP port) through the semantics tree: tree, tap by label,
text, key, scroll, wait, shot, console. Never touches the live display;
attaches only to HeadlessChrome. The MCP server wraps the same Driver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZ4sULGfyav7EEwQ6vhbfg
2026-10-24 22:37:49 +02:00

23 lines
914 B
Python

"""Named keys the ``key`` verb can press."""
from __future__ import annotations
# name -> (key, code, windowsVirtualKeyCode, text). Text makes chromium emit
# the char event Flutter's text input listens for (Enter submits a field).
KEYS: dict[str, tuple[str, str, int, str]] = {
"Enter": ("Enter", "Enter", 13, "\r"),
"Escape": ("Escape", "Escape", 27, ""),
"Tab": ("Tab", "Tab", 9, ""),
"Backspace": ("Backspace", "Backspace", 8, ""),
"Delete": ("Delete", "Delete", 46, ""),
"Space": (" ", "Space", 32, " "),
"ArrowUp": ("ArrowUp", "ArrowUp", 38, ""),
"ArrowDown": ("ArrowDown", "ArrowDown", 40, ""),
"ArrowLeft": ("ArrowLeft", "ArrowLeft", 37, ""),
"ArrowRight": ("ArrowRight", "ArrowRight", 39, ""),
"Home": ("Home", "Home", 36, ""),
"End": ("End", "End", 35, ""),
"PageUp": ("PageUp", "PageUp", 33, ""),
"PageDown": ("PageDown", "PageDown", 34, ""),
}