← Back to Browser domain

Browser.getWindowForTarget

Get the browser window that contains the devtools target.

Domain: Browser experimental

Parameters

NameTypeDescription
targetId (optional)Target.TargetIDDevtools agent host id. If called as a part of the session, associated targetId is used.

Returns

NameTypeDescription
windowIdWindowIDBrowser window id.
boundsBoundsBounds information of the window. When window state is 'minimized', the restored window position and size are returned.

Example Request

{
  "id": 1,
  "method": "Browser.getWindowForTarget"
}

Example Response

{
  "id": 1,
  "result": {
    "windowId": "windowId-value",
    "bounds": "bounds-value"
  }
}

Usage in Node.js

const result = await send('Browser.getWindowForTarget');
console.log(result);
// {"windowId": "windowId-value", "bounds": "bounds-value"}