Skip to main content
Module

x/astral/mod.ts>Keyboard

A high-level puppeteer/playwright-like library for Deno
Go to Latest
class Keyboard
Re-export
import { Keyboard } from "https://deno.land/x/astral@0.2.1/mod.ts";

Keyboard provides an api for managing a virtual keyboard. The high level api is Keyboard.type(), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.

Constructors

new
Keyboard(celestial: Celestial)

Methods

Dispatches a keydown event.

Shortcut for Keyboard.down() and Keyboard.up().

sendCharacter(char: string)

Dispatches a keypress and input event. This does not send a keydown or keyup event.

type(text: string | KeyInput[], opts?: KeyboardTypeOptions)

Sends a keydown, keypress/input, and keyup event for each character in the text.

up(key: KeyInput)

Dispatches a keyup event.