← Back to Target domain
Target.attachToTarget
Attaches to the target with given id.
Domain: Target
stable
Parameters
| Name | Type | Description |
targetId | TargetID | |
flatten (optional) | boolean | Enables "flat" access to the session via specifying sessionId attribute in the commands.
We plan to make this the default, deprecate non-flattened mode,
and eventually retire it. See crbug.com/991325. |
Returns
| Name | Type | Description |
sessionId | SessionID | Id assigned to the session. |
Example Request
{
"id": 1,
"method": "Target.attachToTarget",
"params": {
"targetId": "TARGET_ID_HERE"
}
}
Example Response
{
"id": 1,
"result": {
"sessionId": "SESSION_001"
}
}
Usage in Node.js
const result = await send('Target.attachToTarget', {"targetId": "TARGET_ID_HERE"});
console.log(result);
// {"sessionId": "SESSION_001"}