hubcap tap — Touch-tap an element

When to use

Touch-tap an element for mobile emulation. Use click for desktop mouse clicks. Pair with emulate for full mobile simulation.

Usage

hubcap tap <selector>

Arguments

ArgumentTypeRequiredDescription
selectorstringyesCSS selector of the element to tap

Flags

None.

Output

FieldTypeDescription
tappedbooleanWhether the tap succeeded
selectorstringThe selector that was used
{"tapped":true,"selector":"#submit"}

Errors

ConditionExit codeStderr
Element not found1error: element not found: <sel>
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Tap a button in a mobile-emulated page:

hubcap tap '#submit'

Emulate a mobile device, then tap a hamburger menu:

hubcap emulate 'iPhone 15' && hubcap tap '.hamburger-menu'

See also

  • click - Single-click an element (desktop)
  • swipe - Swipe gesture on an element
  • pinch - Pinch gesture on an element
  • emulate - Emulate a mobile device