cdp-driver 0.5.0

Chrome DevTools Protocol (CDP) client for Rust: every command, event and type generated from the schema, with sessions, for browser automation and AI agents
Documentation
//! Keyboard names as `Input.dispatchKeyEvent` wants them.

/// The `code` and Windows virtual key code for a key name.
///
/// Unrecognised keys pass through with a virtual key code of 0, which is what
/// CDP expects for printable characters that carry no special code.
pub fn key_info(key: &str) -> (&str, u32) {
    match key {
        "Enter" => ("Enter", 13),
        "Tab" => ("Tab", 9),
        "Backspace" => ("Backspace", 8),
        "Delete" => ("Delete", 46),
        "Escape" => ("Escape", 27),
        " " | "Space" => ("Space", 32),
        "ArrowLeft" => ("ArrowLeft", 37),
        "ArrowUp" => ("ArrowUp", 38),
        "ArrowRight" => ("ArrowRight", 39),
        "ArrowDown" => ("ArrowDown", 40),
        _ => (key, 0),
    }
}