Skip to Content

type

Type text into an input element. Supports three modes: replace, append, and paste.

Signature

await utils.type(selector, text, options?)

Parameters

ParamTypeDefaultDescription
selectorstring—CSS selector or XPath
textstring—Text to type
options.mode"replace" | "append" | "paste""replace"Typing mode
options.delaynumber50Delay between keystrokes (ms). Ignored in paste mode
options.waitTimeoutnumber0Max wait time for element (ms). Default: instant
options.frameFrame—Optional frame to search within

Modes

ModeBehavior
replaceTriple-click to select all → type new text (clears old value)
appendType without clearing — adds to existing text
pasteSet value directly via JS (fast, no keystroke simulation)

Examples

// Replace mode (default) — clear then type await utils.type("#email", "user@test.com"); // Append — add text to existing value await utils.type("#tags", ", new-tag", { mode: "append" }); // Paste — set value instantly (good for long strings) await utils.type("#private-key", "0xABCD...", { mode: "paste" }); // Wait for element before typing await utils.type("#lazy-input", "hello", { waitTimeout: 8000 });

Error Handling

Throws if the element is not found.

Last updated on