To open a new page with Puppeteer, launch or connect to a browser, then await browser.newPage(). It returns a Page object you can use to navigate and interact with that page.
Open a page after launching Puppeteer
This complete ES module example creates a browser, opens a page in its default browser context, visits a URL, and closes the browser it launched:
As an Amazon Associate I earn from qualifying purchases.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());
} finally {
await browser.close();
}
The launch → page creation → navigation → cleanup sequence follows Puppeteer’s getting-started guide. browser.newPage() is asynchronous and resolves to a Page object. A browser can have multiple Page instances, each controlling a tab-like page.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Choose the right browser context
| Call | Where the page belongs | Use it when |
|---|---|---|
browser.newPage() |
The browser’s default context | You want the straightforward page-creation path. |
context.newPage() |
A separately created browser context | You want browser state such as cookies and local storage isolated from other contexts, or want to close the context’s pages together. |
The context controls the state-isolation boundary. Create one with browser.createBrowserContext(), then create its page with context.newPage(), as shown in the official browser-management guide.
#1 Best Overall
const context = await browser.createBrowserContext();
try {
const page = await context.newPage();
await page.goto('https://example.com');
} finally {
await context.close();
}
Closing the context closes its pages. If you also launched the browser for this script, close the browser when the work is complete.
Open a page in a browser that is already running
When another process owns the browser lifecycle, connect to it rather than launching a second browser. The connection requires the browser WebSocket endpoint or another supported connection option for your setup.
Rank #2
import puppeteer from 'puppeteer';
const browser = await puppeteer.connect({
browserWSEndpoint: process.env.BROWSER_WS_ENDPOINT,
});
try {
const page = await browser.newPage();
await page.goto('https://example.com');
} finally {
await browser.disconnect();
}
Set BROWSER_WS_ENDPOINT to the endpoint provided by the browser you are connecting to. Use browser.disconnect() here: it detaches Puppeteer without shutting down the externally launched browser or closing its pages. By contrast, browser.close() closes the browser and is appropriate when your script owns that lifecycle.
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 glitchesCommon problems and fixes
browser.newPage is not a function: Make sure you are calling it on the Browser object returned bypuppeteer.launch()orpuppeteer.connect(), not on thePageobject returned bynewPage().- The call is made before the browser is ready: Await
puppeteer.launch()orpuppeteer.connect()before callingbrowser.newPage(); awaitbrowser.newPage()itself before using the returned page. - The new page shares browser state you wanted isolated:
browser.newPage()uses the default context. Create a separate context withbrowser.createBrowserContext()and callcontext.newPage(). - The browser unexpectedly shuts down: If another process launched it, use
browser.disconnect()for cleanup instead ofbrowser.close().
Or skip the browser setup
If your goal is a website screenshot rather than browser automation, ScreenshotNeo returns a screenshot or PDF from one GET request. See the API documentation for options.
Quick Recap
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with response headers indicating the page verdict and billing status. Its MCP server offers screenshot, page-info, and PDF tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan.
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.




