Overview
OpenSteer provides methods for keyboard input beyond the standardinput() method. These allow you to press individual keys and type text character-by-character.
Methods
pressKey()
Press a keyboard key. Useful for special keys like Enter, Tab, Escape, arrow keys, etc.
The key to press. Can be a character or special key name like
'Enter', 'Tab', 'Escape', 'ArrowDown', etc.Examples
Press Enter key
Navigate with arrow keys
Press Escape to close dialog
Common special keys
type()
Type text character-by-character into the currently focused element. Unlike input(), this doesn’t target a specific element.
The text to type
Examples
Type into focused element
Type and submit
Comparison: type() vs input()
| Feature | type() | input() |
|---|---|---|
| Element targeting | Uses currently focused element | Targets specific element |
| Clearing | Does not clear existing text | Clears by default (clear: true) |
| Speed | Character-by-character (slower) | Direct value assignment (faster) |
| Use case | Keyboard simulation, autocomplete | Form filling, replacing values |
Use
input() for most form filling scenarios. Use type() when you need to simulate real keyboard input or trigger autocomplete/search suggestions.Related methods
- input() - Fill text into specific elements
- click() - Click elements to focus them
- pressKey() on Playwright - See Playwright docs for all supported key names