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.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To route automated browser traffic through a proxy, configure the browser session or context that loads the page. Proxy settings for downloading a browser binary are a separate concern: they can let a framework install its browser, but do not by themselves route the pages you automate. The right setup depends on the framework, desired scope, proxy protocol, authentication, and whether your network intercepts certificates.

First distinguish browser traffic from browser downloads

Automation involves two different network paths. A framework may download a browser before a test starts; later, that browser makes requests to the target site. An installation proxy only addresses the first path. To route page requests, configure the browser, session, or context that actually runs the test.

This distinction matters especially with Puppeteer and Playwright, whose documentation separately covers browser downloads and browser operation. For authorized testing, enterprise network access, or approved network-location checks, verify which path is failing before changing settings.

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

Configure a proxy in Selenium 4

Selenium 4 uses browser options classes, and Selenium WebDriver exposes proxy settings as a capability. Its documentation describes proxy use cases including capturing network traffic, mocking backend calls made by a website, and reaching sites through complex network topologies or strict corporate restrictions. Exact behavior can depend on the browser driver and its supported capabilities; the documentation does not establish that every driver supports identical proxy features. See the Selenium browser options guide.

Java example for Chrome

Set the proxy on the options object used to create the WebDriver session. Selenium’s example uses an HTTP proxy address in HOST:PORT form:

import org.openqa.selenium.Proxy;
import org.openqa.selenium.chrome.ChromeOptions;

Proxy proxy = new Proxy();
proxy.setHttpProxy("proxy.example.com:8080");

ChromeOptions options = new ChromeOptions();
options.setCapability("proxy", proxy);

// Use options when creating the driver:
// WebDriver driver = new ChromeDriver(options);

Replace the example hostname and port with values supplied by your organization or proxy administrator. For a remote WebDriver session, pass the options instance when creating the session; the options also determine which browser is requested.

Rank #2

What to verify

  • Confirm the selected driver accepts the proxy capability and that the browser session starts with the options you set.
  • Check that the proxy is reachable from the machine or container running the browser, not merely from your development workstation.
  • If the browser starts but the page cannot load, investigate proxy reachability, authentication, and network policy separately from driver startup.

Configure a proxy in Playwright

Playwright documents HTTP, HTTPS, and SOCKSv5 proxy support. You can configure a proxy for the whole browser or for an individual browser context. HTTP(S) configuration can include a username and password, and a bypass setting can exclude specified hosts. Use browser-wide configuration when contexts should share a policy; use context-level configuration when separate test contexts need different proxy settings. Context-level configuration applies when creating the context, not retroactively to one already created. Examples and options are in the Playwright network guide.

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

Set a proxy for a browser context

In Playwright’s JavaScript API, pass the proxy when creating a context:

const context = await browser.newContext({
  proxy: {
    server: 'http://proxy.example.com:8080',
    username: 'proxy-user',
    password: 'proxy-password',
    bypass: 'localhost,*.internal.example'
  }
});

Use only the fields your proxy requires. Keep credentials out of source control; load them from your organization’s approved secret store or environment configuration. Check the proxy server syntax and bypass rules against the live documentation and your proxy administrator’s instructions.

Set a proxy for the browser

For browser-wide policy, provide the proxy when launching the browser rather than when creating a context. Playwright’s test configuration also supports proxy configuration; use the form documented for the API and runner version in your project. This keeps the scope explicit: browser-level settings are shared, while context-level settings allow per-context choices.

Configure proxy behavior in Puppeteer

Puppeteer’s configuration guide documents HTTP_PROXY, HTTPS_PROXY, and NO_PROXY as environment-only settings for downloading and running the browser. That guide does not provide a complete runtime proxy recipe for every Puppeteer and Chrome setup, so do not assume these environment variables alone prove that page requests are routed as intended. The distinction and package limitations are covered in the Puppeteer configuration guide.

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

Set environment variables for the documented configuration

On a Unix-like shell, the environment can be set for a command like this:

HTTP_PROXY=http://proxy.example.com:8080 
HTTPS_PROXY=http://proxy.example.com:8080 
NO_PROXY=localhost,127.0.0.1 
npm test

These variables are environment configuration, not a guarantee that a particular browser launch or page request uses the proxy. Verify runtime traffic in your own authorized setup and consult the Chrome and Puppeteer guidance appropriate to your versions when you need a complete runtime-specific configuration.

Account for package and download behavior

  • puppeteer-core ignores Puppeteer configuration files and environment variables.
  • For browser downloads through a proxy, the Puppeteer guide says the optional peer dependency proxy-agent is required.
  • Puppeteer normally downloads and uses a specific Chrome version. If using another Chrome or Chromium binary, the guide documents selecting it with executablePath.

The Puppeteer configuration page displayed version 25.12.0 when accessed on October 7, 2026. Confirm current instructions for the version installed in your project.

Put Playwright browser downloads behind a proxy

Playwright downloads browsers from Microsoft’s CDN by default. For installation behind a corporate proxy, its browser guide documents HTTPS_PROXY. If TLS interception causes a self-signed certificate-chain error, the guide describes setting NODE_EXTRA_CA_CERTS to the custom root certificate before installation. For a slow connection, PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT increases the download connection timeout. These are installation controls; they are not substitutes for the runtime proxy option. See Playwright browser installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
HTTPS_PROXY=http://proxy.example.com:8080 npx playwright install

When your organization intercepts TLS, configure the approved root certificate in the environment before running the install command. Do not disable certificate validation to work around a trust-chain error.

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

Compare the framework choices

Framework Runtime proxy scope Documented protocol and controls Download considerations
Selenium 4 Proxy capability on browser options used to create a WebDriver session HTTP proxy shown in the Selenium options example; driver support can vary The cited options guide addresses browser-session capabilities, not browser downloads
Puppeteer Environment configuration is documented for downloading and running the browser; a complete runtime recipe for every setup is not established by that guide HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables Browser downloads through a proxy require the optional proxy-agent peer dependency
Playwright Browser-wide or individual browser-context configuration HTTP(S) and SOCKSv5; HTTP(S) username/password and bypass hosts HTTPS_PROXY; NODE_EXTRA_CA_CERTS for an intercepted certificate chain; configurable download connection timeout

Troubleshoot in the order the failure occurs

  1. Identify the failing stage. If installation cannot fetch a browser, check the download proxy. If installation succeeds but a page cannot load, inspect the runtime browser or context proxy.
  2. Check the endpoint. Confirm the proxy hostname, port, scheme, and reachability from the machine or container running the browser.
  3. Check authentication. Confirm credentials are supplied in the supported way for the framework and proxy type. Avoid putting secrets into committed test files or logs.
  4. Check bypass rules. A host excluded from proxying may connect directly and fail under a restricted network. Review the effective bypass list and test with a host that should use the proxy.
  5. Check certificate trust for downloads. If an enterprise proxy intercepts TLS, use the organization’s trusted root certificate as documented for the framework; do not confuse this with runtime proxy selection.
  6. Confirm package and driver constraints. For Selenium, check the chosen driver’s capabilities. For Puppeteer, account for puppeteer-core ignoring configuration and environment variables, and for the download dependency if applicable.
  7. Validate routing with an authorized destination. Confirm the observed connection path using a test endpoint and network logs you are permitted to inspect. Do not infer successful routing merely because the browser launched.

Use proxies within authorization and policy

Proxy configuration is appropriate for approved enterprise access, controlled test environments, and explicitly authorized network-location testing. Follow the target site’s terms and your organization’s rules, and use credentials and network routes only with permission. The framework documentation supports configuration techniques; it does not guarantee that a proxy will make a site reachable or that a particular test outcome will succeed.

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.