exposeDevToolsProtocol method

Future<void> exposeDevToolsProtocol(
  1. TargetID targetId, {
  2. String? bindingName,
  3. bool? inheritPermissions,
})

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. bindingName Binding name, 'cdp' if not specified. inheritPermissions If true, inherits the current root session's permissions (default: false).

Implementation

Future<void> exposeDevToolsProtocol(
  TargetID targetId, {
  String? bindingName,
  bool? inheritPermissions,
}) async {
  await _client.send('Target.exposeDevToolsProtocol', {
    'targetId': targetId,
    if (bindingName != null) 'bindingName': bindingName,
    if (inheritPermissions != null) 'inheritPermissions': inheritPermissions,
  });
}