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

To screenshot a cookie-authenticated page with Puppeteer, set the site’s valid cookies on a BrowserContext before navigating, wait for an authenticated page element, then call page.screenshot(). For HTTP Basic or Digest authentication, use page.authenticate() before navigation instead. These are different mechanisms: HTTP credentials do not sign you into an ordinary HTML login form.

Choose the authentication method the site actually uses

Method Use it when Important limitation
Set cookies The application session is represented by valid browser cookies you already have. Cookie scope and attributes must match the site; the session may expire or depend on additional state.
page.authenticate() The protected resource uses HTTP authentication. It is not a general login-form API. Puppeteer enables request interception internally, which may affect performance.
Log in through the site The application requires a form, OAuth, MFA, or a custom identity provider and you do not have usable session cookies. The login steps depend on the application. The Puppeteer APIs below do not replace that flow.

Puppeteer’s current documentation recommends setting cookies through BrowserContext or Browser; page-level cookie methods are deprecated. See the Puppeteer cookies guide and the BrowserContext.setCookie() reference.

Set cookies before navigating, then capture the page

This Node.js example uses a separate browser context, adds a cookie scoped to the target site, navigates, checks for an authenticated-only element, and saves a full-page PNG. Replace the example domain, cookie name and value, and ready selector with values for your application.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  const context = await browser.createBrowserContext();

  try {
    await context.setCookie({
      name: 'session',
      value: process.env.SESSION_COOKIE,
      url: 'https://example.com/',
      httpOnly: true,
      secure: true,
      sameSite: 'Lax',
    });

    const page = await context.newPage();
    await page.goto('https://example.com/account', {
      waitUntil: 'domcontentloaded',
    });

    // Use a signal that appears only after the application has authenticated.
    await page.waitForSelector('[data-testid="account-dashboard"]', {
      timeout: 15000,
    });

    await page.screenshot({ path: 'account.png', fullPage: true });
  } finally {
    await context.close();
    await browser.close();
  }
})();

Install Puppeteer in your project if needed with npm install puppeteer. The example expects a session cookie in the SESSION_COOKIE environment variable; do not put a real session secret in source control or print it in logs. Puppeteer’s screenshot guide demonstrates the navigation-and-capture workflow: Screenshots.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works

Cookie fields and scope

The cookie must be valid for the destination. Set either an appropriate url association or a matching domain and path, as supported by the cookie API. Depending on the site, relevant fields can include expires, secure, httpOnly, sameSite, and partitioning data. Do not assume that copying a token into a cookie named session is enough: the site determines the required name, value, scope, and flags. See Puppeteer’s CookieData API.

Use an existing default context

If you do not need isolation, Puppeteer also provides browser.setCookie(...) for the default browser context. With separate sessions, prefer a distinct context and establish that run’s storage there. Browser contexts isolate cookies and other storage such as local storage; see the Browser.setCookie() API and Page class reference.

Rank #2
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)

Use HTTP authentication when the server requests it

For an HTTP-authenticated resource, provide credentials before requesting it:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();
    await page.authenticate({
      username: process.env.HTTP_USERNAME,
      password: process.env.HTTP_PASSWORD,
    });

    await page.goto('https://example.com/protected', {
      waitUntil: 'domcontentloaded',
    });
    await page.waitForSelector('[data-testid="protected-content"]', {
      timeout: 15000,
    });
    await page.screenshot({ path: 'protected.png' });
  } finally {
    await browser.close();
  }
})();

Page.authenticate() is specifically for HTTP authentication, not a substitute for filling in a web app’s login form or completing OAuth or MFA. Puppeteer documents that this method enables request interception behind the scenes, which may affect performance; consult the Page.authenticate() API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Choose what part of the page to capture

  • Visible viewport: await page.screenshot({ path: 'capture.png' }) captures the current viewport.
  • Whole document: use fullPage: true. The image can be much taller than the viewport.
  • Specific rectangle: pass a clip rectangle in screenshot options when you need a region.
  • One element: use elementHandle.screenshot(); Puppeteer scrolls the element into view when necessary.
  • Output: screenshot options support a path or returned image data, output types, clipping, and transparent-background behavior where supported by the selected type.

See the Page.screenshot() API, ScreenshotOptions API, and ElementHandle.screenshot() API for the available signatures and options.

Wait for authenticated readiness, not just navigation

A successful navigation does not prove that the application accepted the session, and a generic network-idle condition does not guarantee that the interface is authenticated or visually settled. Prefer a meaningful application signal, such as a dashboard element that only appears when signed in, as in the examples. If the target renders content asynchronously, wait for the relevant selector or another app-specific condition before capture. Choose timeouts based on the application and environment rather than treating one delay as universally reliable.

Rank #4
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

The screenshot shows a login page

  • Confirm that the session cookie is still valid and belongs to the correct environment.
  • Check its name, value, domain or URL association, path, and security attributes against the site’s expected cookie.
  • Set it before navigating to the protected page, then wait for an authenticated-only selector.
  • If the site requires a form, OAuth, MFA, or additional state, cookie injection alone may not complete its login flow.

The cookie is set but not sent

Review whether the cookie’s host and path cover the destination and whether flags such as secure or sameSite fit the request context. The required values are site-specific; consult the application’s own authentication behavior rather than assuming a universal cookie configuration.

The wait times out

The selector may not exist for that account, may have changed, or may only render after a redirect or client-side request. Verify the resulting page and choose a stable element that indicates the intended authenticated state. A timeout means the readiness check was not satisfied; it is not by itself proof that the screenshot API failed.

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

HTTP credentials do not sign in

Use page.authenticate() only when the server uses HTTP authentication. For a normal login page, automate the site’s actual flow or provide a valid session using the site’s supported mechanism.

Capture is slow

page.authenticate() turns on request interception internally and may affect performance. Also avoid waiting on a condition that the application never reaches; use the narrowest meaningful readiness signal for the screenshot you need.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request can return an image or PDF; for an authenticated page, pass supported custom cookies or authorization details. See the ScreenshotNeo documentation for the current parameters and authentication requirements.

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

ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; those steps 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 exposes take_screenshot, get_page_info, and capture_pdf 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 free ScreenshotNeo access.

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

Frequently Asked Questions

Can Puppeteer reuse a cookie copied from my browser?

It can use valid cookie data, but only if the cookie’s scope, attributes, and any related session state match the target site.

Can I take a screenshot without saving it to a file?

Yes. Puppeteer’s screenshot method can return image data; see the Page.screenshot() API for the current return type and options.

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.72
Bestseller No. 4
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$69.99

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.