DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk2 min

How to List Pages in a Puppeteer BrowserContext

Use Puppeteer's context.pages() to enumerate open pages within one BrowserContext, and learn how context scope differs from browser-wide page listing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use await context.pages() to get the open Puppeteer pages associated with a specific BrowserContext. It returns a Promise<Page[]>, so await the call before iterating over the pages.

List pages in one BrowserContext

Call pages() on the context whose pages you want to inspect:

As an Amazon Associate I earn from qualifying purchases.

const pages = await context.pages();

for (const page of pages) {
  console.log(await page.title(), page.url());
}

This assumes context is an existing Puppeteer BrowserContext. Each returned item is a Page, so you can use page methods such as title() and url(). Puppeteer’s BrowserContext API describes the method as getting the list of open pages inside that context.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose context.pages() or browser.pages()

The key difference is scope: use the context method for one user context, or the browser method when you need pages across contexts.

Method Scope Use it when
await context.pages() Pages in that BrowserContext Your task is limited to one context, including an isolated context.
await browser.pages() Pages across the browser’s contexts You need a browser-wide list rather than a context-specific one.

A BrowserContext represents an individual user context with isolated storage such as cookies and local storage. A popup opened by a page belongs to its parent page’s context, so it is included in that context’s scope. To inspect the browser’s contexts, call await browser.browserContexts(); Puppeteer documents that a newly created browser returns a single context from this method. See the Browser API for browser.pages().

Know which pages are omitted

By default, context.pages() omits non-visible pages, including background pages. The optional includeAll argument exists, but Puppeteer marks it experimental; check the behavior for the Puppeteer version used by your application before relying on it. The method is documented in the BrowserContext API.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

For non-visible pages, Puppeteer points to Target.page(). You can also inspect active targets in the context with context.targets(). A target is not necessarily a page, so use Target.page() when you need a page object for a particular target. See the BrowserContext targets API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

If your goal is a website screenshot rather than managing Puppeteer pages, ScreenshotNeo can return an image or PDF from one GET request. For example, this cURL command captures Stripe as a WebP image:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo free.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

What does context.pages() return?

A promise that resolves to an array of Puppeteer Page objects for open pages in that context.

Does context.pages() include background pages by default?

No. Non-visible pages such as background pages are omitted by default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • 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

How do I inspect all browser contexts?

Call await browser.browserContexts().

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.