While it shouldn't, as connecting over CDP typically means you want to use the context of the existing browser.
In my case I'm connecting with Bright Data to bypass security layers.
I've forked the project and fixed this myself, as I drastically needed this feature to work.
Here is the fix, to playwright-server.js on line 321:
// CDP browsers (e.g. Bright Data Scraping Browser) already have a pre-configured context. // Use it instead of creating a new one, which would lack proxy/session settings. const existingContexts = attached.contexts(); const context = existingContexts.length > 0 ? existingContexts[0] : await attached.newContext();
Instead of:
const context = await attached.newContext();
While it shouldn't, as connecting over CDP typically means you want to use the context of the existing browser.
In my case I'm connecting with Bright Data to bypass security layers.
I've forked the project and fixed this myself, as I drastically needed this feature to work.
Here is the fix, to playwright-server.js on line 321:
// CDP browsers (e.g. Bright Data Scraping Browser) already have a pre-configured context. // Use it instead of creating a new one, which would lack proxy/session settings. const existingContexts = attached.contexts(); const context = existingContexts.length > 0 ? existingContexts[0] : await attached.newContext();Instead of:
const context = await attached.newContext();