In the main website of chrome DevTools protocol, there's a section for Target Domain.
In puppeteer library, there's a JS class for that, And it has got just a few methods.
What's Target and What's for?
A target, as described in your question, can be a page, background page, service worker, browser, and more.
In other words, a target is essentially the current frame or environment that is in focus.
The Chrome DevTools Protocol Documentation describes the Target Domain as:
Target Domain
Supports additional targets discovery and allows to attach to them.
Puppeteer, a Node.js library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol, has a Target class which is documented as the following:
class: Target
target.browser()
- returns: <Browser>
Get the browser the target belongs to.
target.browserContext()
- returns: <BrowserContext>
The browser context the target belongs to.
target.createCDPSession()
- returns: <Promise<CDPSession>>
Creates a Chrome Devtools Protocol session attached to the target.
target.opener()
- returns: <?Target>
Get the target that opened this target. Top-level targets return
null
.target.page()
If the target is not of type
"page"
or"background_page"
, returnsnull
.target.type()
- returns: <string>
Identifies what kind of target this is. Can be
"page"
,"background_page"
,"service_worker"
,"browser"
or"other"
.target.url()
- returns: <string>