hubcap find

Find text occurrences on the page.

When to use

Find text occurrences on the page. Returns match count and positions. Use waittext to wait for text to appear instead of checking once.

Usage

hubcap find <text>

Arguments

ArgumentTypeRequiredDescription
textstringYesText string to search for on the page

Flags

None.

Output

FieldTypeDescription
foundbooleantrue if at least one occurrence exists
countnumberTotal number of occurrences on the page
textstringThe text string that was searched for
{"found":true,"count":3,"text":"hello"}

Errors

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

Examples

Search for a word on the page:

hubcap find "Login"

Check if an error message appears:

hubcap find "Something went wrong"

Check for text and conditionally take action based on the result:

hubcap find "Success" | jq -e '.found' && hubcap screenshot success.png

See also

  • waittext - Wait for text to appear on the page
  • text - Get the inner text of a specific element
  • exists - Check if an element exists by CSS selector