Overview
Sets keyboard focus on an element and types the specified text. The command automatically focuses the element before typing, ensuring text is entered into the correct field.Syntax
Parameters
Element reference from snapshot (
@e1, @e2, etc.)Text to type (max 10,000 characters)
Response
Response Fields
The action performed (
type_text)The element reference that received the text
Behavior
The type command:- Sets focus on the element using
Action::SetFocus - Types text character-by-character using keyboard events
- Preserves existing text (appends by default)
- Supports all printable characters and special keys
Usage Examples
Type into Text Field
Fill Form Fields
Type with Special Characters
Type into Code Editor
Text Handling
| Character Type | Behavior |
|---|---|
| Printable chars | Typed as-is |
| Newline (\n) | Presses return key |
| Tab (\t) | Presses tab key |
| Special symbols | Typed with shift if needed |
| Emoji | Supported (Unicode) |
Performance
- Typing speed: ~50-100 chars/second
- For large text (>1000 chars), use
set-valuefor better performance - Max length: 10,000 characters per command
Error Cases
| Error Code | Cause | Recovery |
|---|---|---|
ELEMENT_NOT_FOUND | Ref doesn’t exist in current refmap | Run snapshot to refresh |
STALE_REF | Element no longer matches saved ref | Run snapshot and use new ref |
ACTION_FAILED | Element cannot receive keyboard focus | Try set-value instead |
INVALID_ARGS | Text exceeds 10,000 characters | Split into smaller chunks |
Type vs Set-Value
| Command | Use Case | Speed | Triggers Events |
|---|---|---|---|
type | Mimics user typing | Slower | Yes (keydown, keyup) |
set-value | Direct value assignment | Faster | No keyboard events |
type when:
- App validates input on keypress
- Autocomplete needs to trigger
- Keyboard shortcuts should fire
set-value when:
- Large text needs to be entered quickly
- No validation on keypress
- Direct value assignment is acceptable
Notes
- Text is appended by default; use
clearfirst to replace - Focus is set automatically before typing
- Command blocks until typing completes
- Use
clipboard-set+cmd+vfor very large text - Supports hyphenated arguments with
allow_hyphen_values