hubcap text — Get the inner text of an element

When to use

Get the inner text of an element. Use html for the full outer HTML. Use value for form input values.

Usage

hubcap text <selector>

Arguments

ArgumentTypeRequiredDescription
selectorstringyesCSS selector of the element to read

Flags

None.

Output

FieldTypeDescription
selectorstringThe selector that was used
textstringThe inner text of the element
{"selector":"h1","text":"Welcome to Hubcap"}

Errors

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

Examples

Get the text of a heading:

hubcap text 'h1'

Get button text and pipe it to another command:

hubcap text '.status-message' | jq -r '.text'

See also

  • html - Get outer HTML of an element
  • value - Get the value of an input element
  • attr - Get an attribute of an element
  • query - Query a DOM element