hubcap type

Type text keystroke by keystroke into the currently focused element.

When to use

Type text keystroke by keystroke into the currently focused element. Does NOT clear existing content first. Use fill to clear and then type. Use press for special keys like Enter or Tab.

Usage

hubcap type <text>

Arguments

ArgumentTypeRequiredDescription
textstringYesText to type, with optional escape sequences (\n for Enter, \t for Tab, \\ for literal backslash)

Flags

None.

Output

FieldTypeDescription
typedbooleanWhether the typing succeeded
textstringThe text that was typed
{"typed":true,"text":"hello world"}

Errors

ConditionExit codeStderr
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Type a simple string:

hubcap type 'hello world'

Type text and press Enter:

hubcap type 'search query\n'

Type text with a Tab between fields:

hubcap type 'first\tlast'

Focus an input first, then type into it:

hubcap focus '#search' && hubcap type 'hubcap cli'

See also

  • fill - Clear and type into an input field
  • press - Press a single key or key combination
  • focus - Focus an element before typing
  • clear - Clear an input field