Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Call context.targets() on the Puppeteer BrowserContext you want to inspect. It synchronously returns a Target[] for the active targets in that context.
List targets in one BrowserContext
Keep a reference to the context you want to inspect, then call its targets() method:
As an Amazon Associate I earn from qualifying purchases.
const targets = context.targets();
console.log(targets);
The documented signature is targets(): Target[], so you do not use await. The result is a snapshot of the targets active when you call the method.
Runnable example
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const context = await browser.createBrowserContext();
const targets = context.targets();
console.log(`Active targets in this context: ${targets.length}`);
for (const target of targets) {
console.log(target.type(), target.url());
}
} finally {
await browser.close();
}
createBrowserContext() creates an isolated browser context. Closing the browser closes its associated pages; the finally block ensures cleanup if inspection or logging fails.
#1 Best Overall
Choose targets, pages, or browser-wide targets
| Need | Use | What it returns or covers |
|---|---|---|
| Every active target in one context | context.targets() |
Synchronous Target[] scoped to that context. |
| Open pages in one context | await context.pages() |
Asynchronous Page[]. By default, non-visible pages such as background pages are omitted. |
| Targets throughout the browser | browser.targets() |
Targets from all browser contexts, not just one. |
| Open contexts in the browser | browser.browserContexts() |
The browser’s BrowserContext objects. |
Use context.targets() when scope matters and you need targets rather than only pages. Use pages() when you want page objects and its default visibility behavior is suitable. The includeAll option for pages() is documented as experimental.
Understand context scope
A BrowserContext isolates browser storage from other contexts. A popup opened by a page belongs to the same context as its opener. Consequently, calling targets() on that context includes its active targets, while calling browser.targets() deliberately broadens the scope to the entire browser.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
If you have multiple contexts, retain the specific context reference associated with the work you are inspecting. Do not substitute the browser-wide method if your requirement is to exclude other contexts.
Common mistakes and fixes
- Using
await context.targets():targets()is synchronous and returns an array directly. Removeawait. - Getting more targets than expected:
browser.targets()spans all contexts. Calltargets()on the intended context instead. - Missing a background target when using
pages():pages()omits non-visible pages by default. Usecontext.targets()to enumerate active targets, or inspect a target withTarget.page()where appropriate. - Expecting targets opened later to appear in an earlier result: the returned array reflects the call time. Call
context.targets()again after the target is created.
Or skip the browser setup
If your goal is a website screenshot rather than Puppeteer target inspection, ScreenshotNeo provides a screenshot API and MCP server. A single request can return an image or PDF; it does not expose Puppeteer Target objects.
Rank #3
cURL example (see the ScreenshotNeo API documentation for options):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie banners and removes known consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server includes screenshot, page-info, and PDF-capture tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a 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.




