Use puppeteer-core to connect Puppeteer to Browserless’s remote Chromium browser, then navigate to a page and call page.screenshot(). You need a Browserless API token and the WebSocket endpoint for your region. This guide shows a complete capture script, explains when the one-shot REST endpoint is simpler, and covers common capture problems.
Connect Puppeteer to Browserless
Because Browserless hosts the browser remotely, install puppeteer-core rather than the full puppeteer package. The full package downloads a local Chromium binary during installation, which you do not need for this connection.
- Install the package with
npm install puppeteer-core. - Get an API token from your Browserless account dashboard.
- Set the token in an environment variable named
BROWSERLESS_TOKEN. Do not commit the token to source control. - Use the WebSocket endpoint for the Browserless deployment and region you intend to use. The SFO hostname below is an official example, not a universal endpoint.
Save this as shot.mjs and run it with BROWSERLESS_TOKEN=your_token node shot.mjs:
import puppeteer from 'puppeteer-core';
const TOKEN = process.env.BROWSERLESS_TOKEN;
if (!TOKEN) throw new Error('Set BROWSERLESS_TOKEN before running this script');
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://production-sfo.browserless.io?token=${TOKEN}`,
});
try {
const page = await browser.newPage();
await page.goto('https://example.com/', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'screenshot.png', fullPage: true });
} finally {
await browser.close();
}
Replace the example hostname with the documented endpoint for your region or deployment. The script creates a page, waits for navigation to reach networkidle2, and saves a full-page PNG. The Puppeteer calls remain the familiar local-browser API; the browser itself runs remotely.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
The finally block matters: closing the connection ends the remote session. If a script exits without closing it, the session can remain active until timeout and may incur billed session time. Browserless’s connection guide also documents passing browser startup options in the connection URL because the remote browser starts before Puppeteer connects. For array-valued Chrome arguments, use its encoded launch parameter.
Choose Puppeteer or the REST screenshot endpoint
| Workflow | Best fit | How the result is handled |
|---|---|---|
| Puppeteer WebSocket connection | Use when the script needs page interaction, selectors, custom waits, or multiple operations in one browser session. | Control the page with Puppeteer and save the image using page.screenshot(), including its path option. |
Browserless /screenshot REST endpoint |
Use for a single capture without custom page interaction. | Send a POST request with a URL or raw HTML, a token, and screenshot options; the response contains image bytes. |
The REST request’s options go in an options object. For example, a full-page PNG request has this shape:
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
{
"url": "https://example.com/",
"options": {
"fullPage": true,
"type": "png"
}
}
Browserless documents PNG, JPEG, and WebP output, along with full-page capture, quality, clip regions, viewport-related settings, and selector-based capture. Quality applies to lossy formats such as JPEG and WebP, not PNG. The REST endpoint also accepts waiting configuration and navigation options.
Set capture options and handle dynamic pages
Choose the image extent and format
With Puppeteer, page.screenshot() accepts options including path, fullPage, type, quality, and clip. Use fullPage: true when you need the page beyond the current viewport; use clip when only a defined region matters. Browserless’s REST endpoint exposes corresponding capture options in its options object.
Rank #3
Wait for the content you need
A navigation condition such as networkidle2 is useful when a page settles after loading, but it does not guarantee that every page-specific element is ready. For content that appears later, wait for an appropriate selector or condition before taking the screenshot. The REST API offers waiting configuration and navigation options as well.
Load lazy content on long pages
Lazy-loaded images may not appear until they enter the viewport. Browserless’s REST API supports a scrollPage request setting to scroll and trigger lazy loading; combine that with full-page capture when the page requires it. In Puppeteer, use page-level scrolling or interaction before calling screenshot() if the site loads content on scroll.
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
Troubleshoot incomplete or failed screenshots
- Connection fails: Confirm that the token is present and valid, and that the WebSocket hostname matches your Browserless region or deployment. Do not assume the SFO example endpoint applies to every account.
- The remote session remains active: Ensure the script reaches
browser.close(), including when navigation or capture throws. Afinallyblock handles that cleanup. - The capture is blank or missing content: Check whether the site uses bot detection or returns a CAPTCHA or access-denied page. Browserless identifies bot detection as a likely cause of these results.
- Images or sections are absent: Wait for the specific content, and for lazy-loaded material scroll the page before capture. A navigation wait alone may not trigger content loaded only after scrolling or interaction.
- The capture stops at the viewport: Set
fullPage: truein Puppeteer or the equivalent REST option.
For sites requiring anti-bot handling, Browserless documents a separate /unblock endpoint that can return a screenshot when configured to do so. It is an optional route, not a guarantee that every protected site can be captured.
Or skip the browser setup
For a single screenshot without managing a remote browser session, ScreenshotNeo accepts one GET request and returns an image or PDF. Its screenshot API removes cookie banners, newsletter popups, and chat widgets before capture; those cleanup steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses report the page verdict and billing status in headers. Its MCP server also lets AI agents use screenshot tools.
Install nothing for this request; replace YOUR_API_KEY and the target URL. See the ScreenshotNeo API documentation for request options.
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 offers 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000. Learn about ScreenshotNeo or sign up for the free plan.
Frequently Asked Questions
Can I use the full `puppeteer` package with Browserless?
You can, but `puppeteer-core` is the recommended choice for a remote Browserless browser because it avoids downloading local Chromium.
Does Browserless’s SFO WebSocket URL work for every region?
No. It is an example endpoint; use the endpoint documented for your deployment and region.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchQuick Recap
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.

