hubcap url

Get the URL of the current page.

When to use

Use url to retrieve just the current page URL. Use info if you need the URL along with the title and meta information in a single call. Use waiturl to block until the URL matches a specific pattern.

Usage

hubcap url

Arguments

None.

Flags

None.

Output

FieldTypeDescription
urlstringThe URL of the current page
{
  "url": "https://example.com"
}

Errors

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

Examples

Print the current URL:

hubcap url

Extract just the URL string:

hubcap url | jq -r '.url'

Navigate and verify the final URL after redirects:

hubcap goto "https://example.com/redirect" && hubcap waitload && FINAL=$(hubcap url | jq -r '.url') && echo "Landed on: $FINAL"

See also

  • title - get the current page title
  • info - get combined page information (title, URL, meta)
  • waiturl - wait for the URL to match a pattern