hubcap highlight — Highlight an element for debugging

When to use

Visually highlight an element for debugging. Use --hide to remove the highlight.

Usage

hubcap highlight <selector> [flags]

Arguments

ArgumentTypeRequiredDescription
selectorstringyesCSS selector of the element to highlight

Flags

FlagTypeDefaultDescription
—hideboolfalseHide existing highlight

Output

When highlighting:

FieldTypeDescription
highlightedbooleanWhether the highlight was applied
selectorstringThe selector that was used
{"highlighted":true,"selector":".sidebar"}

When hiding:

FieldTypeDescription
hiddenbooleanWhether the highlight was removed
{"hidden":true}

Errors

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

Examples

Highlight a sidebar element:

hubcap highlight '.sidebar'

Highlight an element, take a screenshot, then remove the highlight:

hubcap highlight '.sidebar' && hubcap screenshot --output debug.png && hubcap highlight '.sidebar' --hide

See also

  • bounds - Get element bounding box
  • visible - Check if an element is visible
  • styles - Get computed CSS styles