Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesUse await browser.targets() to list every active Puppeteer target across all browser contexts. Each returned item is a Target; call target.type() to identify it and target.url() to inspect its URL. To restrict the list to one context, use context.targets().
List all browser targets
Browser.targets() returns a Target[] containing active targets across browser contexts. This example prints each target’s type and URL:
As an Amazon Associate I earn from qualifying purchases.
const targets = await browser.targets();
for (const target of targets) {
console.log(target.type(), target.url());
}
Use it with an initialized Puppeteer browser instance. The method lists targets; it does not create pages or change browser state. See the Puppeteer Browser.targets() reference.
Choose the right listing method
| Method | What it returns | Scope and coverage |
|---|---|---|
browser.targets() |
Active Target objects |
Across all browser contexts |
context.targets() |
Active Target objects |
Only within that browser context |
pages() |
Page objects | A page-oriented view; it omits non-visible pages such as background pages |
Use browser.targets() for complete active-target enumeration. Choose context.targets() when your task concerns only one context. If you need visible pages rather than every target, a pages listing may be the more suitable view, but it is not a replacement for target enumeration. The BrowserContext.targets() reference and the BrowserContext.pages() reference document those distinctions.
#1 Best Overall
Identify target types
A target is not necessarily a visible tab. Puppeteer documents these Target.type() values: background_page, browser, other, page, service_worker, shared_worker, and webview. Check the type before assuming a target behaves like a page.
for (const target of await browser.targets()) {
const type = target.type();
const url = target.url();
if (type === 'page') {
console.log('Page:', url);
} else {
console.log('Non-page target:', type, url);
}
}
For the documented target categories, consult the TargetType reference and Target.type() reference.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Limit enumeration to a browser context
Contexts isolate storage. A newly created browser has at least one default context; create a separate context when you need an isolated session, then enumerate its targets with context.targets().
const context = await browser.createBrowserContext();
const page = await context.newPage();
const targets = await context.targets();
for (const target of targets) {
console.log(target.type(), target.url());
}
The new page is created in that context, and the context-level method limits the returned list to targets in that context. See the Browser.createBrowserContext() reference and BrowserContext.newPage() reference.
Rank #3
Troubleshoot unexpected results
- Some tabs or targets are missing: Check that you called
browser.targets(), not a context-scoped method. Also remember thatpages()omits non-visible pages such as background pages. - A result is not a regular page: Inspect
target.type(). Workers, browser targets, and other documented target kinds can appear in the results. - The target list is narrower than expected: Confirm which
BrowserContextyou queried.context.targets()is intentionally scoped to that context. - Types or method behavior differ from your installed package: Check your installed Puppeteer version and use its matching API reference. The official API pages reviewed for this guide reported versions from 25.9.0 through 25.12.0, so this code is not a promise that every release has identical documentation.
Or skip the browser setup
If your goal is a screenshot rather than inspecting Puppeteer targets, ScreenshotNeo can return an image or PDF from one GET request. Cookie banners, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status. Its MCP server provides screenshot tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for 1,000 free screenshots a month, with no card.
Quick Recap
Best Value
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




