hubcap raw

Send a raw Chrome DevTools Protocol command.

When to use

Send raw Chrome DevTools Protocol commands for protocol methods not covered by dedicated hubcap commands. This is an escape hatch for advanced or uncommon protocol interactions. Use --browser for browser-level commands like Target.getTargets or Browser.getVersion.

Usage

hubcap raw [--browser] <method> [params-json]

Arguments

ArgumentTypeRequiredDescription
methodstringYesprotocol method name (e.g. Page.reload, DOM.getDocument)
params-jsonstringNoJSON string of method parameters

Flags

FlagTypeDefaultDescription
--browserboolfalseSend command at browser level instead of page level

Output

The raw protocol result JSON, exactly as returned by the protocol.

FieldTypeDescription
(varies)objectThe protocol method response, structure depends on the method called
{"frameTree":{"frame":{"id":"main","url":"https://example.com"}}}

Errors

ConditionExit codeStderr
Missing method argument1usage: hubcap raw [--browser] <method> [params-json]
Protocol error1error: <message>
Chrome not connected2error: connecting to Chrome: ...
Timeout waiting for response3error: timeout

Examples

Reload the page:

hubcap raw Page.reload

Get the document root node:

hubcap raw DOM.getDocument '{"depth": 1}'

Target the browser to list all open targets:

hubcap raw --browser Target.getTargets

Get browser version info:

hubcap raw --browser Browser.getVersion

Enable a protocol domain and pipe the result to jq for filtering:

hubcap raw Network.enable && hubcap raw Network.getResponseBody '{"requestId":"1234"}' | jq '.body'

See also

  • eval - Evaluate JavaScript in the page without raw protocol
  • version - Print browser version information