← Back to Target domain

Target.exposeDevToolsProtocol

Inject object to the target's main frame that provides a communication channel with browser target. Injected object will be available as `window[bindingName]`. The object has the following API: - `binding.send(json)` - a method to send messages over the remote debugging protocol - `binding.onmessage = json => handleMessage(json)` - a callback that will be called for the protocol notifications and command responses.

Domain: Target experimental

Parameters

NameTypeDescription
targetIdTargetID
bindingName (optional)stringBinding name, 'cdp' if not specified.
inheritPermissions (optional)booleanIf true, inherits the current root session's permissions (default: false).

Example Request

{
  "id": 1,
  "method": "Target.exposeDevToolsProtocol",
  "params": {
    "targetId": "TARGET_ID_HERE"
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Target.exposeDevToolsProtocol', {"targetId": "TARGET_ID_HERE"});
console.log(result);