logo of Screenshot for Web
Free toolsPlaygroundDocsBlogPricing
LoginDashboard

Company

HomeFeaturesPricingBlogFacts

Screenshot Tools

Website ScreenshotsFull Page ScreenshotsScrolling ScreenshotsWebsite HistoryPDF Generation APIScreenshot API

Legal

Terms of UsePrivacy PolicyCookie PolicyCopyrightSecurity

Support

FAQSupportContact UsAPI Status
screen shot for web logo

No clutter. No distractions. Just clean, full-page screenshots with smart customization.

© 2026 HYDRANODE LTD. All rights reserved.

Screenshot for Web is operated by HYDRANODE LTD, a company registered in England and Wales, company number 15672526. Registered office: 124 City Road, London, London, England, EC1V 2NX.

FacebookInstagramLinkedInYouTube
  1. Home
  2. Blog
  3. News

Puppeteer 25.19 stops print and dark mode emulation from cancelling each other

Before Puppeteer 25.19.0, emulateMediaType and emulateMediaFeatures reset each other, losing print or dark mode. Our tests, the fix and a workaround.

Screenshot for Web·November 26, 2026·5 min read

Sources

  1. Puppeteer releases: puppeteer-core v25.19.0 release notes
  2. Puppeteer pull request #15745: keep the media type when emulating media features
  3. Puppeteer pull request #15775: serialize page screenshots across browser contexts
  4. Chrome DevTools Protocol: Emulation.setEmulatedMedia
  5. Puppeteer API: Page.emulateMediaType()
  6. Puppeteer API: Page.emulateMediaFeatures()
  7. spatie/browsershot: bin/browser.cjs
  8. Studiosity/grover: lib/grover/js/processor.cjs

How this article was made

Researched and drafted with AI assistance from the sources listed. On 26 November 2026 we ran every code sample and test script with puppeteer-core 25.18.1 and 25.19.0 (and the bug check also with puppeteer 24.11.1) against Google Chrome 158.0.8127.37 on an Apple M5 Mac. The captures, PDFs and timings in the figures come from those runs.

Capture any page without ads, banners or chat widgets, free and without an account.

Try the free tools

More articles

  • News

    Chrome 158 drops XSLT: what it does to screenshots of sitemaps and feeds

    We captured eight live sitemaps in Chrome 156 and Chromium 158. Styled pages turn into raw XML, a red warning bar is already in captures, and two fixes work.

    November 9, 2026
  • Research

    Chrome DevTools' full-size screenshot: where it fails on long and lazy pages

    We ran DevTools' full-size screenshot on six long pages: it stops at 16,384 pixels and misses content that appears on scroll. Here's why, and the fixes that worked.

    November 8, 2026
  • Research

    Running headless Chrome yourself vs a screenshot API: memory and time for 100 captures

    We ran 100 real-site captures six ways on a 2-CPU, 4 GB container and measured time, CPU, memory and failures, to show what self-hosting really asks of a server.

    November 7, 2026

If your Puppeteer code calls both page.emulateMediaType() and page.emulateMediaFeatures(), Puppeteer 25.18.1 keeps only the one you called last, and so did 24.11.1, the other older version we tested. Ask for print styles and then dark mode, and you get screen styles in dark mode. Ask for dark mode and then screen styles, and you get light mode. Puppeteer 25.19.0, released on 25 November 2026, fixes this. Below are the tests we ran on both versions, what the fix changes, a workaround for older versions, and what the release's other screenshot change, a browser-wide screenshot lock, does to capture speed.

What goes wrong

Puppeteer sends both settings to Chrome through one DevTools Protocol (CDP) command, Emulation.setEmulatedMedia. It takes two optional parameters: media, the CSS media type, and features, a list of media features such as prefers-color-scheme. When either parameter is left out, Chrome resets it.

Up to 25.18.1, Puppeteer sent each setting on its own: emulateMediaType() sent only media, and emulateMediaFeatures() sent only features. So each call wiped out the other. The 25.19.0 code now keeps one combined state and always sends both, with a comment saying that the command "resets the media type or the features when they are omitted". Pull request #15745 explains the impact: PDF wrappers call the two methods in exactly this order, so their pages render with the wrong media. We checked two of the wrappers it names. The browsershot (PHP) and grover (Ruby) sources both call emulateMediaType and then emulateMediaFeatures.

Our test

We ran the script below with puppeteer-core 25.18.1 and with 25.19.0. To keep the browser the same in both runs, both used the Google Chrome 158.0.8127.37 installed on the Mac instead of the browser each release downloads. The script tries the calls in both orders on fresh pages and asks the page which media queries match.

import puppeteer from 'puppeteer-core';

const browser = await puppeteer.launch({
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
});
const dark = [{ name: 'prefers-color-scheme', value: 'dark' }];
const state = (page) => page.evaluate(() => ({
  print: matchMedia('print').matches,
  dark: matchMedia('(prefers-color-scheme: dark)').matches,
}));

const a = await browser.newPage();
await a.emulateMediaType('print');
await a.emulateMediaFeatures(dark);
console.log('type, then features:', await state(a));

const b = await browser.newPage();
await b.emulateMediaFeatures(dark);
await b.emulateMediaType('screen');
console.log('features, then type:', await state(b));

await browser.close();

Output with 25.18.1:

type, then features: { print: false, dark: true }
features, then type: { print: false, dark: false }

Output with 25.19.0:

type, then features: { print: true, dark: true }
features, then type: { print: false, dark: true }

The second line is correct in both versions only because screen is also what the page uses with no emulation. Losing the media type looks harmless there, but the lost dark mode is a real change. The same script with puppeteer 24.11.1 printed the same wrong results as 25.18.1, so this behaviour is not new in the 25.x line.

What it does to screenshots and PDFs

We made a small test page that prints which media type and colour scheme are active, then captured it after each pair of calls.

Captures of a test page showing its active media type and colour scheme. With puppeteer-core 25.18.1, print plus dark shows screen in dark, and dark plus screen shows a white page in light mode. With 25.19.0 they show print and dark, then screen and dark.

Two practical results (for the basics of each, see our guides to dark-mode screenshots and HTML to PDF in JavaScript):

  1. Dark-mode screenshots come out light. If your code turns on dark mode and later sets the media type, perhaps in a separate helper that runs before every capture, 25.18.1 and older silently go back to light mode.
  2. PDFs use the wrong stylesheet. Chrome uses print styles for page.pdf() unless the media type is set to screen. We set screen and then dark mode, generated a PDF with each version, and extracted the text with pdftotext. The 25.18.1 PDF said "media type: print" and the 25.19.0 PDF said "media type: screen". Anyone asking for a PDF that looks like the screen version got the print version instead.

The fix, and a workaround for older versions

The fix is to upgrade to puppeteer or puppeteer-core 25.19.0. Note that 25.19.0 also moves the bundled Chrome to 158.0.8127.88, so test your captures after upgrading as usual.

If you can't upgrade yet, set both values in one CDP call. Chrome then gets both parameters together and neither resets the other:

import puppeteer from 'puppeteer-core';

const browser = await puppeteer.launch({
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
});
const page = await browser.newPage();

// One CDP call sets both, so neither can reset the other.
const cdp = await page.createCDPSession();
await cdp.send('Emulation.setEmulatedMedia', {
  media: 'print',
  features: [{ name: 'prefers-color-scheme', value: 'dark' }],
});

console.log(await page.evaluate(() => ({
  print: matchMedia('print').matches,
  dark: matchMedia('(prefers-color-scheme: dark)').matches,
})));
await browser.close();

This printed { print: true, dark: true } with both 25.18.1 and 25.19.0. Puppeteer doesn't track settings made this way, so don't mix this call with later emulateMediaType() or emulateMediaFeatures() calls on the same page. On older versions, those calls would reset one of the values again.

A smaller thing we noticed: to clear the feature emulation, call emulateMediaFeatures() with no argument or with []. Passing null threw a protocol error ("Failed to deserialize params.features") in both versions. The method's signature doesn't allow null anyway, unlike emulateMediaType(), whose documentation says null turns off media emulation.

The other screenshot change: one lock per browser

The same release lists "serialize page screenshots across browser contexts" (pull request #15775). It moves Puppeteer's screenshot lock from each browser context to the browser, and removes a separate lock on Page.screenshot that the pull request calls redundant. If you run captures in parallel in isolated contexts, you might expect this to slow you down. In our test it didn't. The removed lock in 25.18.1 was already keyed on the browser, so screenshots in one browser already ran one at a time.

We took full-page screenshots of a 7,200-pixel-tall local page at a 1280×800 viewport, four at once, seven rounds per setup, and recorded the median time.

Bar chart of time to take four full-page screenshots at once: one page alone takes 1.6 to 1.7 s, four pages in one context or in four contexts take 6.4 to 6.8 s, and four pages in four separate browsers take 1.8 s.

Setup (4 screenshots at once)25.18.125.19.0
1 page alone, for comparison1,631 to 1,679 ms1,621 to 1,694 ms
4 pages in 1 context6,451 to 6,771 ms6,420 to 6,654 ms
4 pages in 4 contexts6,404 to 6,596 ms6,439 to 6,690 ms
4 pages in 4 browsers1,824 ms1,766 ms

Four screenshots in one browser took about four times as long as one, whether or not the pages shared a context, and the two versions were within run-to-run noise. Four separate browser processes finished all four in about the time of one. So if screenshot throughput matters, run more browser processes, not more contexts. Contexts still matter for isolation: they keep cookies and storage apart between captures.

What to do

  • Upgrade to Puppeteer 25.19.0 if any code path sets both a media type and media features, including PDF wrappers built on Puppeteer.
  • Check your dark-mode captures and screen-styled PDFs from before the upgrade. Any that went through both calls may have been captured in light mode or with print styles.
  • On older versions, use the single Emulation.setEmulatedMedia call above.

If you'd rather not manage this yourself, our free screenshot tool and screenshot API handle browser setup for you.