Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pptr/src/FrameManager.ts>Frame#type

Headless Chrome Deno API
Latest
method Frame.prototype.type
import { Frame } from "https://deno.land/x/pptr@1.2.0/src/FrameManager.ts";

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

Examples

Example 1

await frame.type('#mytextarea', 'Hello'); // Types instantly
await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user

Parameters

selector: string
  • the selector for the element to type into. If there are multiple the first will be used.
text: string
  • text to type into the element
optional
options: { delay: number; }
  • takes one option, delay, which sets the time to wait between key presses in milliseconds. Defaults to 0.

Returns

Promise<void>

a promise that resolves when the typing is complete.