hubcap check — Check a checkbox

When to use

Check a checkbox. Idempotent — does nothing if already checked. Use uncheck to uncheck.

Usage

hubcap check <selector>

Arguments

ArgumentTypeRequiredDescription
selectorstringyesCSS selector of the checkbox to check

Flags

None.

Output

FieldTypeDescription
checkedbooleanWhether the checkbox is now checked
selectorstringThe selector that was used
{"checked":true,"selector":"#agree-tos"}

Errors

ConditionExit codeStderr
Element not found1error: JS exception: Uncaught
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Check the terms-of-service checkbox:

hubcap check '#agree-tos'

Check a checkbox, then submit the form:

hubcap check '#agree-tos' && hubcap click '#submit'

See also

  • uncheck - Uncheck a checkbox
  • click - Single-click an element
  • visible - Check if an element is visible