diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts index 1c50df84fc..c0d77dcf50 100644 --- a/packages/playwright-core/src/server/chromium/chromium.ts +++ b/packages/playwright-core/src/server/chromium/chromium.ts @@ -91,7 +91,13 @@ export class Chromium extends BrowserType { browserLogsCollector: new RecentLogsCollector(), artifactsDir, downloadsPath: artifactsDir, - tracesDir: artifactsDir + tracesDir: artifactsDir, + // On Windows context level proxies only work, if there isn't a global proxy + // set. This is currently a bug in the CR/Windows networking stack. By + // passing an arbitrary value we disable the check in PW land which warns + // users in normal (launch/launchServer) mode since otherwise connectOverCDP + // does not work at all with proxies on Windows. + proxy: { server: 'per-context' }, }; progress.throwIfAborted(); const browser = await CRBrowser.connect(chromeTransport, browserOptions); diff --git a/tests/chromium/chromium.spec.ts b/tests/chromium/chromium.spec.ts index 2df27927bc..5d24b581d5 100644 --- a/tests/chromium/chromium.spec.ts +++ b/tests/chromium/chromium.spec.ts @@ -418,3 +418,25 @@ playwrightTest('should connect to an existing cdp session when passed as a first await browserServer.close(); } }); + +playwrightTest('should use proxy with connectOverCDP', async ({ browserType, server }, testInfo) => { + server.setRoute('/target.html', async (req, res) => { + res.end('