Call and await page.setUserAgent() before navigating, then capture the page with page.screenshot(). That changes the user-agent value sent by the page; it does not by itself reproduce a real device’s viewport or full fingerprint.
Set the user agent before navigation
This ES module example launches Puppeteer, overrides the page’s user agent, waits for the page to reach networkidle2, and saves a full-page PNG:
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.setUserAgent('ExampleBot/1.0 (+https://example.com/bot)');
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'screenshot.png', fullPage: true });
} finally {
await browser.close();
}
The user-agent string is illustrative, not an identity for a real crawler or browser. Replace it with the exact value appropriate to your test or documented client. Await the setter so the override is applied before the request to the site. See Puppeteer’s Page.setUserAgent() reference and screenshots guide.
Use the signature supported by your installed version
The current API reference documents an options-object form, with userAgent and optional userAgentMetadata and platform. The reference also exposes a positional signature and marks a warning obsolete, so older code and current documentation may differ. Check the reference matching your installed Puppeteer version; do not combine signatures from different versions. The API reference lists versioned documentation at pptr.dev/api.
#1 Best Overall
Choose between a user-agent override and device emulation
Use setUserAgent() when the only change you need is the page’s user-agent value. If you want a known mobile or other device layout, use Puppeteer’s KnownDevices entry and page.emulate(device) instead. The documented emulation shortcut sets both the device user agent and viewport. Apply emulation before navigating, since resizing can affect a site’s layout. It is not a guarantee of complete real-device fingerprint simulation. See the Page class reference.
Control the screenshot independently
The user-agent override determines the value sent for the page; screenshot options determine the image output. Puppeteer documents these useful options:
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
pathsaves the image. If you do not set an explicit type, Puppeteer infers it from the filename extension.fullPage: truerequests a full-page capture; the documented default isfalse.clipcaptures a selected region instead of the whole page.typeselects an output format.qualityapplies where supported, but not to PNG.
These settings are independent of the user-agent override. Consult Puppeteer’s ScreenshotOptions reference for the installed version’s available settings.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshoot unexpected results
- The site still sees the previous user agent: Make sure you call and await
page.setUserAgent()beforepage.goto(). The setter is asynchronous. - The mobile screenshot still has a desktop layout: A user-agent override alone does not set a mobile viewport. Use
page.emulate(device)with a PuppeteerKnownDevicesentry before navigation when you need the documented device user agent and viewport together. - Your code rejects or the method signature does not match: Check the API reference for the Puppeteer version installed in your project. The current reference’s options form and older positional signatures should not be mixed.
- The saved image is not the expected size or format: Check the filename extension,
type,fullPage, andclip. Output controls do not change the page’s user agent. networkidle2does not suit the page: Some pages keep network connections open or load content after navigation. Choose a navigation wait condition appropriate to the page, then capture only after the content you need is present; Puppeteer’s screenshots guide covers the capture workflow.
Or skip the browser setup
ScreenshotNeo takes a screenshot with one GET request. Its API accepts a URL and returns an image or PDF; use the custom user_agent option if you need to send a particular user-agent value. See the ScreenshotNeo API documentation for request options.
Rank #3
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture, with each step configurable. Bot checks, blank pages, and failed loads are never billed; response headers report the page verdict and billing status. Its MCP server offers 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. Sign up for 1,000 free screenshots a month, with no card required.
FAQ
Does Browser.userAgent() return the override?
Puppeteer documents Browser.userAgent() as reporting the browser’s original user agent; pages can override it with Page.setUserAgent(). See the Browser.userAgent() reference.
Quick Recap
Best Value
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
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.




