hubcap pinch

Perform a pinch zoom gesture on an element.

When to use

Use pinch to simulate a two-finger pinch gesture for mobile emulation testing. Use swipe for directional swipe gestures. Pair with emulate to set a mobile device profile for full mobile simulation.

Usage

hubcap pinch <selector> <direction>

Arguments

ArgumentTypeRequiredDescription
selectorstringYesCSS selector of the element to pinch
directionstringYesPinch direction: in (zoom out) or out (zoom in)

Flags

None.

Output

FieldTypeDescription
pinchedbooleanWhether the pinch succeeded
directionstringThe pinch direction that was performed
selectorstringThe selector that was pinched
{"pinched":true,"direction":"out","selector":"#map"}

Errors

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

Examples

Pinch out to zoom into a map:

hubcap pinch '#map' out

Pinch in to zoom out of an image:

hubcap pinch '.photo-viewer' in

Emulate a mobile device then pinch to zoom:

hubcap emulate 'iPhone 14' && hubcap pinch '#map' out

See also

  • swipe - Touch swipe gesture
  • tap - Touch tap gesture
  • emulate - Emulate a mobile device