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

Set the two controls separately: call Puppeteer’s current page.setUserAgent(options) before navigation, and route Chromium through Tor with --proxy-server=... when launching the browser. A User-Agent string changes what the site sees about the browser; it does not change your network route. The proxy changes the route; it does not choose a User-Agent.

The working pattern

Use a browser-wide proxy argument and set the User-Agent on the page before the first request that needs the value. This is the smallest complete pattern:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    args: ['--proxy-server=socks5://127.0.0.1:TOR_PORT'],
  });

  try {
    const page = await browser.newPage();
    await page.setUserAgent({
      userAgent: 'YOUR_TEST_USER_AGENT',
    });
    await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
    console.log(await page.title());
  } finally {
    await browser.close();
  }
})();

Replace TOR_PORT with the SOCKS port exposed by your own Tor setup. There is no universally correct port for every machine, and this code does not install or start Tor.

Why User-Agent and Tor are independent

User-Agent: the HTTP identity

page.setUserAgent(options) sets the browser identity used for subsequent page requests. Puppeteer’s current Page API accepts an options object. The older setUserAgent(userAgent, userAgentMetadata) signature is deprecated, so new code should use the object form.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
GL.iNet GL-MT300N-V2 (Mango) Portable Mini Travel Wireless Pocket VPN WiFi Router - 2X Ethernet Ports | USB 2.0 | OpenWrt | OpenVPN/Wireguard for Public & Hotel Wi-Fi | Easy to Set up via Admin Panel
  • 【WIRELESS MOBILE MINI TRAVEL ROUTER】 Convert a public network (wired or wireless) to a private Wi-Fi for secure surfing. Tethering. Powered by any laptop USB, power banks or 5V/2A DC adapters (sold separately). 39g (1.41 Oz) only, portable and pocket friendly. 2.4GHz ONLY
  • 【OPEN SOURCE & PROGRAMMABLE】 OpenWrt pre-installed, USB disk extendable.
  • 【LARGER STORAGE & EXTENDABILITY】 128MB RAM, 16MB Flash ROM, dual Ethernet ports, UART and GPIOs available for hardware DIY.
  • 【OPENVPN CLIENT】 OpenVPN client pre-installed, compatible with 30+ VPN service providers.
  • 【PACKAGE CONTENTS】 GL-MT300N-V2 (Mango) mini router (2-year Warranty), USB cable, Ethernet cable, User Manual. Please update to the latest firmware.

Set the value before page.goto(), reloads, or other navigation that must carry it. A page that has already made its request cannot have that request retroactively changed.

Proxy: the network route

Chromium receives its route at launch through --proxy-server. Changing the User-Agent does not configure a proxy, and adding a proxy does not select a User-Agent. Keep these settings in separate parts of your program so a failure in one does not disguise a failure in the other.

Choose the proxy scheme and authentication model

Chromium supports HTTP, HTTPS, SOCKS4, and SOCKS5 proxy schemes in the launch argument. Select the scheme that your local Tor endpoint actually exposes.

Scheme Use when Important limitation
http:// Your proxy speaks HTTP CONNECT or HTTP proxying. It is not the same as an HTTPS destination; the proxy protocol and destination protocol are separate.
https:// Your proxy endpoint itself expects an HTTPS connection. Confirm that Chromium and the proxy agree on this protocol.
socks4:// Your endpoint provides SOCKS4. Capabilities differ from SOCKS5, especially around name resolution and authentication.
socks5:// Your endpoint provides SOCKS5, as many Tor integrations do. Chrome’s SOCKS5 implementation does not support SOCKS authentication through page.authenticate().

Do not assume that adding a username and password to a SOCKS5 URL will make Chrome authenticate successfully. If the endpoint requires SOCKS credentials, verify that Chromium supports the required method; the Puppeteer proxy guide specifically warns against expecting page.authenticate() to provide SOCKS5 authentication.

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

Configure a page correctly

Current API with a custom User-Agent

const page = await browser.newPage();
await page.setUserAgent({
  userAgent: 'Mozilla/5.0 (compatible; ExampleTest/1.0)',
});
await page.goto('https://example.com', { waitUntil: 'networkidle2' });

Use a value appropriate for your test. A syntactically valid string is not automatically a truthful browser fingerprint; sites can also observe headers, JavaScript properties, TLS behavior, viewport, and other signals. This setting only addresses the User-Agent value.

Rank #2
Sale
UGREEN NAS DXP2800 2-Bay for Advanced Home Users, Remote Workers & Creators
  • 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
  • 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
  • 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
  • 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
  • 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.

Use a different page or context

Set the User-Agent on every page that needs it. A new page does not inherit a setting you applied to a different page object. If you create multiple browser contexts, apply the setting in each context’s page setup. The --proxy-server launch argument, by contrast, is browser-wide.

Set the value before every relevant navigation

For redirects and subresources initiated by a navigation, Chromium uses the page’s configured setting. If your code changes the value later, the next request is the one that can reflect the change. Avoid relying on a late change after a page has already loaded.

Tor-specific setup without guessing a port

  1. Install and run Tor using the method appropriate for your operating system or environment.
  2. Determine the SOCKS listener address and port from that installation’s configuration or logs.
  3. Start Puppeteer with --proxy-server=socks5://HOST:PORT.
  4. Set the page User-Agent with setUserAgent({ userAgent: ... }).
  5. Navigate only after both settings are in place.

This article does not prescribe a default Tor port because the correct value depends on your local daemon, container, operating system, and configuration. A running Tor process is a prerequisite; Puppeteer does not create one.

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

Verify the two outcomes independently

Check the User-Agent as the destination sees it

After navigation, use the destination’s request or diagnostic view, or an appropriate User-Agent echo endpoint, to confirm the exact string received. Checking only page.evaluate(() => navigator.userAgent) verifies a browser-side property, not necessarily every request path your application makes.

Check the outbound route and IP

Visit a trusted IP-information endpoint through the page and compare the observed address with the route you expect. This checks proxy reachability independently of the User-Agent. The Puppeteer proxy guidance also recommends testing a proxy separately with cURL, which helps distinguish a Tor or proxy problem from a Puppeteer problem.

Rank #3
Sale
Synology DS223 Home & Office Backup Hub - Centralize Files, Protect Data & Monitor Property (2-Bay Diskless NAS)
  • One Place for All Your Data - Consolidate scattered files from multiple computers, phones and external drives into one accessible hub with 100% ownership
  • Professional File Collaboration - Share projects with clients, sync documents across teams and maintain version control without Dropbox fees
  • Automated Backup Protection - Set-and-forget backups for Macs, PCs and mobile devices to multiple destinations including cloud and external drives
  • DIY Surveillance System - Transform IP cameras into a professional monitoring solution with motion alerts, recording schedules and remote viewing
  • 2-Year Warranty - Reliable hardware backed by Synology's expert customer support team and ongoing software updates
const ipPage = await browser.newPage();
await ipPage.setUserAgent({ userAgent: 'YOUR_TEST_USER_AGENT' });
await ipPage.goto('https://your-trusted-ip-endpoint.example/', {
  waitUntil: 'domcontentloaded',
});
console.log(await ipPage.content());

Replace the example endpoint with one you trust. Do not treat a changed User-Agent as evidence that traffic went through Tor, or a changed IP as evidence that the User-Agent was applied.

Browser traffic versus Puppeteer downloads

Puppeteer’s configuration guide discusses HTTP_PROXY, HTTPS_PROXY, and NO_PROXY as environment-only settings for operations such as downloading a browser. Those variables are not a replacement for Chromium’s runtime --proxy-server argument.

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.

This distinction matters with puppeteer-core: its configuration files and environment variables are ignored. If you use puppeteer-core, provide an executable path and launch arguments explicitly, and configure any browser-download process separately.

const puppeteer = require('puppeteer-core');

const browser = await puppeteer.launch({
  executablePath: '/path/to/chromium',
  args: ['--proxy-server=socks5://HOST:PORT'],
});

Do not set only HTTP_PROXY and conclude that page requests are routed through Tor. Test the browser route as described above.

Proxy authentication edge cases

HTTP proxy credentials

For an HTTP proxy that requests authentication, Puppeteer’s page.authenticate() may be relevant. However, website HTTP authentication and proxy authentication are separate challenges. The same credential pair cannot express two different pairs at once. If both the proxy and the website require different credentials, plan the flow accordingly instead of overwriting one challenge with the other.

Rank #4
Master Vpn - Free Unlimited VPN Proxy Server
  • Unlimited bandwidth, unlimited data.
  • Super-fast VPN and one tap connect.
  • Free worldwide multiple servers.
  • Works with all type of data carries. (Wi-Fi, 4G, LTE, 3G).
  • No registration, sign up needed.

SOCKS5 credentials

Do not use page.authenticate() as a SOCKS5 authentication solution. Chrome’s SOCKS5 implementation does not support SOCKS authentication through that API. Use an endpoint and authentication method compatible with Chromium, or place a compatible local relay in front of the service if that is part of your controlled infrastructure.

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

Common failures and fixes

  • The destination shows the old User-Agent. Apply setUserAgent({ userAgent: ... }) before goto() and before any request that matters. Confirm that you are inspecting the same page object and that another navigation is not being tested.
  • The IP did not change. Check the launch argument spelling, scheme, host, and port. Make sure the Tor process is listening and test the proxy independently with cURL. A User-Agent change cannot prove proxy connectivity.
  • Chromium cannot connect. The listener may be stopped, bound to another address, or blocked by a local firewall. Verify the endpoint from the same machine and environment that launches Chromium.
  • SOCKS5 authentication fails. Do not retry with page.authenticate(); that API does not provide Chrome SOCKS5 authentication.
  • Environment variables appear to do nothing. They concern Puppeteer configuration and browser downloads, not a substitute for the runtime launch proxy. They are also ignored by puppeteer-core.
  • A proxy works in cURL but not in Chromium. Compare the scheme and authentication requirements. cURL and Chrome can differ in supported proxy authentication behavior and DNS handling.
  • Only some pages use the intended identity. Set the User-Agent on each page or context. A value configured on one page object does not automatically configure every later page.
  • A per-page proxy plugin causes slow or broken requests. Such plugins can intercept requests and add overhead. Prefer a browser-wide launch proxy when that meets your requirement, and verify compatibility before adopting a plugin.

Operational, privacy and reliability notes

Use a controlled test target

Start with a site you own or are authorized to test. Respect the destination’s terms, robots policy, rate limits, and applicable law. Tor routing does not make abusive or unauthorized automation acceptable.

Expect route variability

Tor can introduce latency, connection failures, and changing exit addresses. Use explicit navigation timeouts, retry only idempotent operations, and record whether a failure occurred during proxy connection, page loading, or application logic. Do not “fix” intermittent failures by silently falling back to a direct connection if privacy or routing is a requirement.

await page.goto('https://example.com', {
  waitUntil: 'domcontentloaded',
  timeout: 90000,
});

Keep secrets out of source

Do not commit proxy credentials, cookies, authorization headers, or API keys. Pass them through a secret manager or protected environment and redact them from logs. The User-Agent itself is not a secret, but it can become part of a recognizable automation profile.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean image or PDF rather than browser automation, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response reports the result with X-Page-Verdict and X-Billed headers.

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

One GET request returns PNG, JPEG, WebP, or PDF. The API supports full-page captures with lazy images loaded, CSS-selector elements, dark mode, device presets or custom viewports, retina scale, PDF paper and margin controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

Best Value
Synology DS124 Personal Backup & File Hub - Protect Photos, Secure Home Surveillance (1-Bay Diskless NAS)
  • Complete Phone & Computer Backup - Automatically protect photos, documents and videos from iPhone android, Mac and Windows to one secure location
  • Your Private File Cloud - Access files from anywhere and share large projects with family or clients without relying on expensive cloud subscriptions
  • Smart Home Security Hub - Monitor your home 24/7 with AI-powered surveillance that detects people, vehicles and sends instant alerts
  • 100% Data Ownership - Keep full control of your personal data with multi-platform access and no monthly subscription fees
  • 2-Year Warranty - Reliable hardware backed by Synology's expert customer support team and ongoing software updates

cURL

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

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for the full parameter list. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan. An MCP server lets AI agents take screenshots without your maintaining a Puppeteer-and-Tor browser setup. Create a free ScreenshotNeo account.

Practical decision checklist

  • Need to automate arbitrary browser interactions, inspect DOM state, or run your own JavaScript? Use Puppeteer and configure User-Agent and proxy independently.
  • Need only a rendered screenshot or PDF? An API can remove browser setup and return the artifact directly.
  • Need Tor specifically? Confirm the local listener, scheme, and authentication model before debugging Puppeteer code.
  • Need reproducible diagnostics? Log the effective User-Agent, proxy configuration without secrets, navigation timing, destination-observed IP, and page verdict separately.

Frequently Asked Questions

Is changing navigator.userAgent enough to change request headers?

No. Configure the page with Puppeteer’s setUserAgent({ userAgent: ... }) before navigation, then verify the value as the destination observes it.

Can one Puppeteer launch use different proxies for different pages?

The documented --proxy-server launch argument is browser-wide. Per-page proxy plugins are a separate approach and can intercept requests and add overhead; verify compatibility before relying on one.

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

Does Tor automatically make a Puppeteer session anonymous?

No. Tor changes the network route. Sites can still observe the User-Agent, browser behavior, cookies, JavaScript properties, and other signals.

Why does a proxy test pass while my page still fails?

The proxy may be reachable while the destination blocks the request, the scheme may differ between tools, or the page may time out over a high-latency route. Test route, User-Agent, and page loading as separate conditions.

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.