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

Short answer: configure the proxy on the APIRequestContext that sends the call, then set a finite request timeout appropriate for your service. A longer timeout only changes how long Playwright waits; it does not route traffic through a corporate proxy. First determine whether the failure comes from a standalone API request, a browser page, or a Playwright browser download, because each path has different settings.

1. Identify which Playwright operation is timing out

“Connection timeout” is not enough to identify the cause. Capture the URL, HTTP method, elapsed time, complete error text or code, and any proxy status or authentication details shown by your CI logs.

Failing operation Configure this Typical clue
Standalone API test using request.newContext() The API request context’s proxy and timeout options Failure occurs on api.get(), api.post(), or another APIRequestContext method
Request made by a page or browser context Browser launch or browser-context proxy settings Failure occurs while navigating a page or making a request from page code
playwright install downloading browsers Download environment variables and certificate trust for the installer process Installation fails before tests start

These configuration surfaces are separate in Playwright’s documentation. A proxy configured for browser traffic is not automatically a proxy configuration for a standalone API request context.

2. Configure a standalone APIRequestContext proxy

For API tests, create the context with the organization’s approved proxy server. The proxy object accepts an HTTP or SOCKS server, an optional comma-separated bypass list, and optional proxy credentials.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
TP-Link USB to Ethernet Adapter,Support Nintendo Switch,1Gbps,Plug and Play
  • 𝐇𝐢𝐠𝐡-𝐒𝐩𝐞𝐞𝐝 𝐔𝐒𝐁 𝐄𝐭𝐡𝐞𝐫𝐧𝐞𝐭 𝐀𝐝𝐚𝐩𝐭𝐞𝐫 - UE306 is a USB 3.0 Type-A to RJ45 Ethernet adapter that adds a reliable wired network port to your laptop, tablet, or Ultrabook. It delivers fast and stable 10/100/1000 Mbps wired connections to your computer or tablet via a router or network switch, making it ideal for file transfers, HD video streaming, online gaming, and video conferencing.
  • 𝐔𝐒𝐁 𝟑.𝟎 𝐟𝐨𝐫 𝐅𝐚𝐬𝐭𝐞𝐫, 𝐌𝐨𝐫𝐞 𝐒𝐭𝐚𝐛𝐥𝐞 𝐃𝐚𝐭𝐚 𝐓𝐫𝐚𝐧𝐬𝐟𝐞𝐫𝐬- Powered via USB 3.0, this adapter provides high-speed Gigabit Ethernet without the need for external power(10/100/1000Mbps). Backward compatible with USB 2.0/1.1, it ensures reliable performance across a wide range of devices.
  • 𝐒𝐮𝐩𝐩𝐨𝐫𝐭𝐬 𝐍𝐢𝐧𝐭𝐞𝐧𝐝𝐨 𝐒𝐰𝐢𝐭𝐜𝐡- Easily connect your Nintendo Switch to a wired network for faster downloads and a more stable online gaming experience compared to Wi-Fi.
  • 𝐏𝐥𝐮𝐠 𝐚𝐧𝐝 𝐏𝐥𝐚𝐲- No driver required for Nintendo Switch, Windows 11/10/8.1/8, and Linux. Simply connect and enjoy instant wired internet access without complicated setup.
  • 𝐁𝐫𝐨𝐚𝐝 𝐃𝐞𝐯𝐢𝐜𝐞 𝐂𝐨𝐦𝐩𝐚𝐭𝐢𝐛𝐢𝐥𝐢𝐭𝐲- Supports Nintendo Switch, PCs, laptops, Ultrabooks, tablets, and other USB-powered web devices; works with network equipment including modems, routers, and switches.
import { request } from '@playwright/test';

const api = await request.newContext({
  baseURL: 'https://api.example.test',
  proxy: {
    server: process.env.CORPORATE_PROXY!,
    bypass: process.env.PROXY_BYPASS,
    username: process.env.PROXY_USER,
    password: process.env.PROXY_PASSWORD,
  },
  timeout: 45_000,
});

try {
  const response = await api.get('/health');
  if (!response.ok()) {
    throw new Error(`Health check failed: ${response.status()} ${await response.text()}`);
  }
} finally {
  await api.dispose();
}

Replace the environment variables with values supplied by your network administrator. The names above are illustrative; Playwright does not require those names. Use the proxy scheme, hostname and port exactly as approved for your environment, for example an HTTP or SOCKS endpoint.

Proxy authentication is separate from API authentication

proxy.username and proxy.password authenticate to the proxy. They do not replace an API key, bearer token, HTTP basic credential, or other authorization required by the destination service. Configure API authorization on the request itself, for example with an Authorization header, while keeping proxy credentials in your CI secret store.

Bypass rules can silently change the route

bypass is a comma-separated list of domains that should skip the proxy. Check every entry against the failing host. An overly broad entry can send traffic directly, where corporate DNS or firewall policy may block it; an overly narrow entry can force an internal service through a proxy that cannot reach it.

Rank #2
Amazon Basics USB 3.0 to 10/100/1000 Gigabit Ethernet Internet Adapter, Compatible with Windows and macOS, Black
  • Connects a USB 3.0 device (computer/laptop) to a router, modem, or network switch to deliver Gigabit Ethernet to your network connection. Does not support Smart TV or gaming consoles (e.g.Nintendo Switch).
  • Supported features include Wake-on-LAN function, Green Ethernet & IEEE 802.3az-2010 (Energy Efficient Ethernet)
  • Supports IPv4/IPv6 pack Checksum Offload Engine (COE) to reduce Cental Processing Unit (CPU) loading
  • Compatible with Windows 8.1 or higher, Mac OS

3. Understand the 30-second timeout

Playwright documents a default APIRequestContext timeout of 30,000 milliseconds (30 seconds). Setting timeout: 45_000 or another finite value gives a slow but healthy service more time to respond. Setting timeout: 0 disables the timeout guard; that can leave a CI worker hanging and should not be a general fix.

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

Timeout and routing solve different problems:

  • Routing: the request reaches the correct proxy and then the destination.
  • Trust: the Node.js process accepts the certificate chain presented on the route.
  • Authentication: the proxy accepts its credentials and the API accepts its credentials.
  • Latency: the service responds within the selected finite budget.

Increase the timeout only after recording elapsed time and confirming that the request is actually using the intended route.

4. Browser-page proxy settings are a different path

If the failing operation is a page navigation or a request issued by browser code, configure the browser globally or on the browser context. Do not assume the API context example above affects pages.

Rank #3
USB A/C to Ethernet Adapter, 3xUSB3.0 and 1000M RJ45 Network hub for Laptop
  • [Expansion Ports] The USB C to Ethernet Adapter expands the device to three USB 3.0 ports and one Gigabit Ethernet port. Provides you more peripheral ports while maintaining a stable network connection, plug and play, no driver required.
  • [Gigabit Network Port] ALL-LUCKY USB Ethernet Adapter transmission rate up to 1000Mbps, also compatible with 10/100Mbps bandwidth. It allows you to enjoy a smooth and stable network connection and avoid too much lag. (Note: To reach 1Gbps, please use CAT6 or above Ethernet cable connection)
  • [Convertible Connector]This usb hub with ethernet not only has USB-A connector, but also can be converted to USB-C connector, so that you can easily convert the connector according to the device port, improve the convenience of use.
  • [High-Speed Data Transfer] The usb to ethernet adapter adopts USB 3.0 transmission technology, supports up to 5Gbps transmission rate, and is compatible with USB 2.0(480Gbps),USB 1.0(12Mbps), easily transfer video, files and other data for you in seconds. (Note: Maximum output current is 900mA, does not support charging devices.)
  • [Widely Compatible]The usb c ethernet adapter for iMac, MacBook Pro, iPad Pro, XPS and many other devices. Compatible with Windows 11/10/8.1/8, Mac OS, iPad OS, Chrome OS.(Note: Driver is required on Win 7) It can be used in office, school, library and other occasions, compact and portable, easy to carry around.
import { chromium } from '@playwright/test';

const browser = await chromium.launch({
  proxy: {
    server: process.env.CORPORATE_PROXY!,
    bypass: process.env.PROXY_BYPASS,
    username: process.env.PROXY_USER,
    password: process.env.PROXY_PASSWORD,
  },
});

const context = await browser.newContext();
try {
  const page = await context.newPage();
  await page.goto('https://example.test', { waitUntil: 'domcontentloaded' });
} finally {
  await browser.close();
}

Browser launch and per-context proxy options are intended for browser traffic. If your test uses both a page and a standalone API context, configure both explicitly and document which one owns each request.

5. Browser installation failures need installer settings

A timeout while downloading a browser is not an API test timeout. Playwright’s installation guidance documents HTTPS_PROXY for browser-download traffic. For a slow connection to the browser archive, it documents PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT; its example is 120000 milliseconds.

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.
# POSIX shells
HTTPS_PROXY=http://proxy.example:8080 
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 
npx playwright install

# PowerShell
$env:HTTPS_PROXY = "http://proxy.example:8080"
$env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT = "120000"
npx playwright install

These variables control the installer process, not the timeout on an APIRequestContext created by your test.

Rank #4
Anker USB C to Ethernet Adapter, Portable 1 Gbps Network Hub
  • The Anker Advantage: Join the 65 million+ powered by our leading technology.
  • Instant Internet: Connect to the internet instantly from virtually any USB-C 3.0 device, and enjoy stable connection speeds of up to 1 Gbps.
  • Lightweight and Compact: The space-saving and portable design measures just over half an inch thick and weighs about the same as a AA battery.
  • Premium Build: Features a sleek aluminum exterior and braided-nylon cable to complement the design of high-end devices.
  • What You Get: PowerExpand USB-C to Gigabit Ethernet Adapter, welcome guide, 18-month worry-free warranty, and friendly customer service.

When certificate interception is involved

Corporate proxies sometimes replace the server certificate with one signed by an internal root CA. If the browser archive reports an untrusted custom certificate, Playwright’s browser-installation guidance advises setting NODE_EXTRA_CA_CERTS to the approved CA bundle before installation:

NODE_EXTRA_CA_CERTS=/secure/certs/corporate-root-ca.pem npx playwright install

This advice is scoped to browser downloads. For API tests, ask the network or service owner which Node.js process must trust the corporate CA and how that trust is distributed. Do not treat a certificate-chain error as a reason to increase the request timeout.

6. A repeatable troubleshooting sequence

  1. Classify the operation. Identify API context, page/browser, or browser installer.
  2. Preserve the failure. Log URL, method, start and end times, error code, response status, and proxy diagnostics without exposing secrets.
  3. Confirm the route. Verify the approved proxy scheme, host and port with IT; inspect bypass for the destination.
  4. Check credentials independently. Confirm proxy credentials and API credentials separately.
  5. Check trust. If the message names a certificate or CA, obtain the approved corporate root and configure the process that actually makes the connection.
  6. Set a measured timeout. Choose a finite value that fits the API’s expected response time and CI job budget.
  7. Reproduce in the same environment. A laptop, container and CI worker can have different proxy variables, DNS, certificates and egress rules.

7. Common errors and precise fixes

Symptom Likely cause Action
Timeout near exactly 30 seconds Default APIRequestContext timeout elapsed Measure service latency, verify routing, then set an explicit finite timeout if justified.
Proxy authentication required or HTTP 407 Missing, incorrect or expired proxy credentials Set proxy.username and proxy.password from the network owner; do not use API credentials.
Certificate has an unknown issuer TLS interception or missing corporate CA trust Install the approved CA for the relevant Node.js process; do not “fix” it by waiting longer.
Internal host fails only when proxy is enabled Incorrect bypass list Review comma-separated bypass domains and the organization’s split-routing policy.
Works locally but fails in CI Different environment variables, DNS, firewall or certificate store Print non-secret configuration, compare runners, and test from the same container or worker image.
playwright install cannot download browsers Installer route or archive trust issue Use HTTPS_PROXY, the documented download connection timeout variable, and approved CA trust for the installer.

8. Reliability and CI practices

  • Keep proxy URLs and credentials in secret-managed CI variables, never in committed test files.
  • Dispose every API request context in a finally block so failed tests do not leak sockets.
  • Use a health endpoint or small diagnostic request to distinguish routing failure from a slow business operation.
  • Record whether the proxy was bypassed, but redact credentials and authorization headers.
  • Keep the timeout finite and aligned with the CI job’s overall deadline; an unlimited request can consume an executor indefinitely.
  • Pin and review the Playwright version used by the project because API options and Node.js behavior can change between versions.
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 to produce a clean image or PDF of a URL rather than exercise an API through Playwright, ScreenshotNeo provides a single HTTP request and an MCP server for AI agents. Its capture pipeline accepts cookie and consent banners, then removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot; each step can be disabled. Bot checks, blank pages, failed loads, timeouts and cache hits are not billed, and response headers identify the page verdict and billing result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the complete option list and request details in the ScreenshotNeo documentation. It supports full-page and selector captures, device presets, custom headers and cookies, JavaScript and CSS, waits, blocking rules, PDFs, signed links, asynchronous webhooks and bulk capture. Claude, Cursor and other MCP clients can use its take_screenshot, get_page_info and capture_pdf tools.

Best Value
Sale
BENFEI USB 3.0 to Ethernet Adapter, USB C to RJ45 Gigabit LAN (1000Mbps) Network Adapter, Compatible with MacBook/Pro/Air, Surface Pro, Windows 11/10/8/7, Mac OS [Aluminium Shell&Nylon Cable]
  • COMPACT DESIGN - The compact-designed portable BENFEI USB A/C to Ethernet adapter connects your computer or tablet to a router,modem or network switch for network connection. It adds a standard RJ45 port to your Ultrabook, notebook or Macbook Air for file transferring, video conferencing, gaming, and HD video streaming.
  • SUPERIOR STABILITY - Built-in advanced IC chip works as the bridge between RJ45 Ethernet cable and your USB A/C devices. The driver-free installation with native driver support in Chrome, Mac, and Windows OS; The USB A/C Ethernet adapter dongle supports important performance features including Wake-on-Lan (WoL), Full-Duplex (FDX) and Half-Duplex (HDX) Ethernet, Crossover Detection, Backpressure Routing, Auto-Correction (Auto MDIX).
  • INCREDIBLE PERFORMANCE - Supports full 10/100/1000Mbps gigabit ethernet performance over USB A/C's 5Gbps bus, faster and more reliable than most wireless connections. Link and Activity LEDs. USB powered, no external power required. Backward compatible with USB 2.0/1.1.✅ To reach 1Gbps, make sure to use CAT6 & up Ethernet cables.
  • BROAD COMPATIBILITY - The USB A/C-Ethernet adapter is compatible with Windows 11/10/8.1/8/7/Vista/XP, Mac OSX 10.6/10.7/10.8/10.9/10.10/10.11/10.12, Linux kernel 3.x/2.6, Android and Chrome OS.Compatible with IEEE 802.3, IEEE 802.3u and IEEE 802.3ab. Supports IEEE 802.3az (Energy Efficient Ethernet).❌Do Not Support Windows RT. (NOT compatible with Nintendo Switch.)
  • 18 MONTH WARRANTY - Exclusive BENFEI Unconditional 18-month Warranty ensures long-time satisfaction of your purchase; Friendly and easy-to-reach customer service to solve your problems timely.

The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

9. Official references

Frequently Asked Questions

Should I set the timeout to zero to stop these failures?

No. Zero disables Playwright’s timeout guard and can hang a worker indefinitely. Use a finite value after verifying the route and expected service latency.

Can an APIRequestContext use the proxy configured for my browser?

Not automatically. Configure the proxy object when creating the standalone API request context; configure browser launch or context settings separately for page traffic.

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

Who can provide my proxy hostname, bypass list and CA certificate?

Your organization’s network or service owners must provide those deployment-specific values. Playwright documentation cannot determine your internal routing, DNS, firewall or trust requirements.

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.