Puppeteer 25.16.0 exposes a proxyServer option when creating a browser context. For an existing Chromium browser, pages in a new context can use a selected intermediary, including a public HTTP candidate from the HTTP proxy list:

const context = await browser.createBrowserContext({
  proxyServer: 'http://proxy.example:8080',
});
try {
  const page = await context.newPage();
  await page.goto('https://www.example.com/');
} finally {
  await context.close();
}

Create another context with another proxyServer for a second route. Two pages created in the same context share that context's proxy policy; opening a tab alone does not select a new endpoint.

The option is proxyServer. The older createIncognitoBrowserContext examples belong to an earlier API generation.

BrowserContextOptions also accepts a proxyBypassList. Keep direct exceptions with the policy for that context instead of assuming they came from another context.

For a supported username/password HTTP proxy, Page.authenticate supplies credentials before navigation. The proxy URL selects the intermediary, and the authentication call supplies the account.

This is browser networking. A package that intercepts a page request and fulfills it with a Node HTTP client's response creates a different transport path, with its own cookie, header and TLS behavior.

The caller still owns the shared browser's lifetime. Closing one context closes its associated pages without ending the other contexts.

متعلقہ مضامین