← Back to Target domain

Target.autoAttachRelated

Adds the specified target to the list of targets that will be monitored for any related target creation (such as child frames, child workers and new versions of service worker) and reported through `attachedToTarget`. The specified target is also auto-attached. This cancels the effect of any previous `setAutoAttach` and is also cancelled by subsequent `setAutoAttach`. Only available at the Browser target.

Domain: Target experimental

Parameters

NameTypeDescription
targetIdTargetID
waitForDebuggerOnStartbooleanWhether to pause new targets when attaching to them. Use `Runtime.runIfWaitingForDebugger` to run paused targets.
filter (optional)TargetFilterOnly targets matching filter will be attached.

Example Request

{
  "id": 1,
  "method": "Target.autoAttachRelated",
  "params": {
    "targetId": "TARGET_ID_HERE",
    "waitForDebuggerOnStart": true
  }
}

Example Response

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

Usage in Node.js

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