You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Allow connecting to CEF instances via browserType.connectOverCDP #10927
I have an application that uses the chromium version 90 from CEF as a browser .
when I run the above snippet it throws the following exception:
browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported.
=========================== logs ===========================
ws://localhost:9222/devtools/browser/01582b7e-7cb0-4bed-a8b1-5e211d3a3ab6
ws://localhost:9222/devtools/browser/01582b7e-7cb0-4bed-a8b1-5e211d3a3ab6
============================================================
at D:\projects\playwright\tests\demo.spec.ts:6:39
at FixtureRunner.resolveParametersAndRunHookOrTest (D:\projects\\playwright\node_modules\@playwright\test\lib\fixtures.js:306:12)
at WorkerRunner._runTestWithBeforeHooks (D:\projects\playwright\node_modules\@playwright\test\lib\workerRunner.js:499:7)
same snippet works fine for the chromium browser 90 when it launched via:
"C:\Users\rakshetri\AppData\Local\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9333 -- "%1"
Reacted by Max Schmitt, shals-praise, rprabhun, Mrxx99, Rohan, nehiwse, Yogita Misal, rajukshetri, Umesh, daruizr and 39 more
Max Schmitt (@mxschmitt) As we are using CEF :https://en.wikipedia.org/wiki/Chromium_Embedded_Framework that uses the embedded chromium to our application and we do not upgrade it so frequently.
Is there any way to use the older library of playwright that support the respective chromium browser .
Is there any workaround or customization to get rid of this issue ?
We already using selenium for such requirement and achieved this with maintaining chromedriver.exe of respective version of chrome.
And we are evaluating playwright as a new tool for replacement of selenium .
Closing since Playwright does not support old Chromium browsers.
Max Schmitt (@mxschmitt)
I have tried with CEF that embedded chromium "Browser": "Chrome/94.0.4606.61", but issue is same .
Unfortunately we don't have product released with CEF which have chrome 96 , but I think this issue is not related to the browser version since same PW configuration works for the standalone browser chrome version 90 installed at machine.
Playwright does not support connecting to CEF instances as of today, since CEF does not expose the Browser.* CDP domain. Will create a feature request out of it.
Reacted by rakshetri-onshape, Mrxx99 and viktor-silakov
changed the title [-][BUG] browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported.[/-][+][Feature] Allow connecting to CEF instances via `browserType.connectOverCDP`[/+]on Dec 16, 2021
Max Schmitt (@mxschmitt) thank you very much I will be highly appreciate your efforts towards this .
I am eagerly waiting for this support as this is road blocking for our CEF e2e testing with PW.
Reacted by Max Schmitt, 吴孔云, Mrxx99, アレクセイ シマコフ and ovclara
Max Schmitt (@mxschmitt) I am evaluating playwright for our automation requirements and so far it seems to be a great e2e testing framework!!..We also need this feature to connect to CEF. Most of the latest testing frameworks do support Chromium Embedded Framework... Waiting to have it supported by playwright soon.!!
Reacted by Mrxx99, Barak Karavani, Thomas Keller, mythsman, ovclara, sean-sexton-gif and AlexDmvDesk
Max Schmitt (@mxschmitt) I am also evaluating playwright for our current automation requirements. I've been using puppeteer as a temporary solution for our CEF e2e testing, but I would love to be able to use the features of playwright. Hoping this feature comes soon!
Max Schmitt (@mxschmitt) I am also evaluating playwright for our current automation requirements. I've been using puppeteer as a temporary solution for our CEF e2e testing, but I would love to be able to use the features of playwright. Hoping this feature comes soon!
collin-rogers please upvote the first comment - thats the way they prioritise feature requests.
This falls outside of the scope for Playwright, so if connectOverCDP does not work for you, there isn't much we can do. Make sure your CEF version matches the Chromium version Playwright is for.
When you run this test, you get error something as:
Error: browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported.
=========================== logs ===========================
ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
But, when you do this change in source of playwright:
node_modules\playwright-core\lib\server\chromium\crBrowser.js
lines 297 to 304 delete or do from lines only comments
if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') {
promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny',
browserContextId: this._browserContextId,
downloadPath: this._browser.options.downloadsPath,
eventsEnabled: true
}));
}
When you run this test, you get error something as: Error: browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported. =========================== logs =========================== ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
But, when you do this change in source of playwright: node_modules\playwright-core\lib\server\chromium\crBrowser.js
lines 297 to 304 delete or do from lines only comments if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') { promises.push(this._browser._session.send('Browser.setDownloadBehavior', { behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny', browserContextId: this._browserContextId, downloadPath: this._browser.options.downloadsPath, eventsEnabled: true })); }
Working on a project where many applications use CEF and CEF versions is not updated always, I wanted to propose - Playwright as a automation tool for this projects, but due to this complexity in connecting CEF seamlessly we are blocked to go ahead.
I see a post on CEF forum : https://magpcss.org/ceforum/viewtopic.php?f=6&t=19313
Where it seems CEF has no plans to expose Browser.* CPD domain, so we look at PlayWright team to have some easy way to handle this so that we could user this Awesome tool.
How use playwright with CEF
tested on playwright 1.33.0 and CEF 110
start app with CEF browser visit http://localhost:XXXX/json/version
where XXXX is debug port
you see something as: { "Browser": "Chrome/110.0.5481.178", "Protocol-Version": "1.3", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36", "V8-Version": "11.0.226.16", "WebKit-Version": "537.36 (@e9acac08b3d8368c80ef92352d046e924969e9bf)", "webSocketDebuggerUrl": "ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e" }
demo test file const {chromium} = require('playwright');
test('demo test', async () => { const browser = await chromium.connectOverCDP( 'here copy webSocketDebuggerUrl from json' ); const defaultContext = browser.contexts()[0]; const myPage = defaultContext.pages()[0]; await myPage.goto('https://playwright.dev/'); });
When you run this test, you get error something as: Error: browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported. =========================== logs =========================== ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
But, when you do this change in source of playwright: node_modules\playwright-core\lib\server\chromium\crBrowser.js
lines 297 to 304 delete or do from lines only comments if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') { promises.push(this._browser._session.send('Browser.setDownloadBehavior', { behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny', browserContextId: this._browserContextId, downloadPath: this._browser.options.downloadsPath, eventsEnabled: true })); }
after change: // if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') { // promises.push(this._browser._session.send('Browser.setDownloadBehavior', { // behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny', // browserContextId: this._browserContextId, // downloadPath: this._browser.options.downloadsPath, // eventsEnabled: true // })); // }
run playwright again... you see npx playwright test example.spec.ts
Running 1 test using 1 worker 1 passed (2.1s)
:-) :-) :-)
edit: when you use this in the test, this working too
const browser = await chromium.connectOverCDP({endpointURL: 'http://localhost:5555'});
For us, using cfsharp (CEF) browser, these hints solve our issue (comment the code suggested upper)
But the demand for this functionality is still live as I can see from the different topics and threads around (not only here in GitHub playwright).
Having this will allow us to switch from cypress to playwright.
When you run this test, you get error something as: Error: browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported. =========================== logs =========================== ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
But, when you do this change in source of playwright: node_modules\playwright-core\lib\server\chromium\crBrowser.js
lines 297 to 304 delete or do from lines only comments if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') { promises.push(this._browser._session.send('Browser.setDownloadBehavior', { behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny', browserContextId: this._browserContextId, downloadPath: this._browser.options.downloadsPath, eventsEnabled: true })); }
Activity
mxschmitt commentedon Dec 15, 2021
mxschmitt commentedon Dec 15, 2021
rajukshetri commentedon Dec 16, 2021
Max Schmitt (@mxschmitt) As we are using CEF :https://en.wikipedia.org/wiki/Chromium_Embedded_Framework that uses the embedded chromium to our application and we do not upgrade it so frequently.
Is there any way to use the older library of playwright that support the respective chromium browser .
Is there any workaround or customization to get rid of this issue ?
We already using selenium for such requirement and achieved this with maintaining chromedriver.exe of respective version of chrome.
And we are evaluating playwright as a new tool for replacement of selenium .
rajukshetri commentedon Dec 16, 2021
Max Schmitt (@mxschmitt)
I have tried with CEF that embedded chromium "Browser": "Chrome/94.0.4606.61", but issue is same .
Unfortunately we don't have product released with CEF which have chrome 96 , but I think this issue is not related to the browser version since same PW configuration works for the standalone browser chrome version 90 installed at machine.
mxschmitt commentedon Dec 16, 2021
Playwright does not support connecting to CEF instances as of today, since CEF does not expose the
Browser.*CDP domain. Will create a feature request out of it.[-][BUG] browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported.[/-][+][Feature] Allow connecting to CEF instances via `browserType.connectOverCDP`[/+]rajukshetri commentedon Dec 17, 2021
Max Schmitt (@mxschmitt) thank you very much I will be highly appreciate your efforts towards this .
I am eagerly waiting for this support as this is road blocking for our CEF e2e testing with PW.
shals-praise commentedon Jan 11, 2022
Max Schmitt (@mxschmitt) I am evaluating playwright for our automation requirements and so far it seems to be a great e2e testing framework!!..We also need this feature to connect to CEF. Most of the latest testing frameworks do support Chromium Embedded Framework... Waiting to have it supported by playwright soon.!!
mxschmitt commentedon Jan 13, 2022
rajukshetri shals-praise please upvote the first comment - thats the way we prioritise feature requests.
collin-rogers commentedon Mar 21, 2022
Max Schmitt (@mxschmitt) I am also evaluating playwright for our current automation requirements. I've been using puppeteer as a temporary solution for our CEF e2e testing, but I would love to be able to use the features of playwright. Hoping this feature comes soon!
rprabhun commentedon Mar 22, 2022
collin-rogers please upvote the first comment - thats the way they prioritise feature requests.
pavelfeldman commentedon Oct 20, 2022
This falls outside of the scope for Playwright, so if connectOverCDP does not work for you, there isn't much we can do. Make sure your CEF version matches the Chromium version Playwright is for.
rebajz commentedon May 4, 2023
How use playwright with CEF
tested on playwright 1.33.0 and CEF 110
start app with CEF browser
visit http://localhost:XXXX/json/version
where XXXX is debug port
you see something as:
{
"Browser": "Chrome/110.0.5481.178",
"Protocol-Version": "1.3",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
"V8-Version": "11.0.226.16",
"WebKit-Version": "537.36 (@e9acac08b3d8368c80ef92352d046e924969e9bf)",
"webSocketDebuggerUrl": "ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e"
}
demo test file
const {chromium} = require('playwright');
test('demo test', async () => {
const browser = await chromium.connectOverCDP(
'here copy webSocketDebuggerUrl from json'
);
const defaultContext = browser.contexts()[0];
const myPage = defaultContext.pages()[0];
await myPage.goto('https://playwright.dev/');
});
When you run this test, you get error something as:
Error: browserType.connectOverCDP: Protocol error (Browser.setDownloadBehavior): Browser context management is not supported.
=========================== logs ===========================
ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
ws://localhost:5555/devtools/browser/22501224-0c07-4649-a8e1-3bc94dcddd0e
But, when you do this change in source of playwright:
node_modules\playwright-core\lib\server\chromium\crBrowser.js
lines 297 to 304 delete or do from lines only comments
if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') {
promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny',
browserContextId: this._browserContextId,
downloadPath: this._browser.options.downloadsPath,
eventsEnabled: true
}));
}
after change:
// if (this._browser.options.name !== 'electron' && this._browser.options.name !== 'clank') {
// promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
// behavior: this._options.acceptDownloads ? 'allowAndName' : 'deny',
// browserContextId: this._browserContextId,
// downloadPath: this._browser.options.downloadsPath,
// eventsEnabled: true
// }));
// }
run playwright again... you see
npx playwright test example.spec.ts
Running 1 test using 1 worker
1 passed (2.1s)
:-) :-) :-)
edit:
when you use this in test, this working too
const browser = await chromium.connectOverCDP({endpointURL: 'http://localhost:5555'});
wkyseo commentedon Jul 6, 2023
rebajz
ovclara commentedon Jul 11, 2023
Working on a project where many applications use CEF and CEF versions is not updated always, I wanted to propose - Playwright as a automation tool for this projects, but due to this complexity in connecting CEF seamlessly we are blocked to go ahead.
I see a post on CEF forum : https://magpcss.org/ceforum/viewtopic.php?f=6&t=19313
Where it seems CEF has no plans to expose Browser.* CPD domain, so we look at PlayWright team to have some easy way to handle this so that we could user this Awesome tool.
AlanCodega commentedon Jul 25, 2023
For us, using cfsharp (CEF) browser, these hints solve our issue (comment the code suggested upper)
But the demand for this functionality is still live as I can see from the different topics and threads around (not only here in GitHub playwright).
Having this will allow us to switch from cypress to playwright.
zotune commentedon May 24, 2024
Can confirm that this works for html CEF panels in Adobe Premiere. Thanks!
Playwright team, could we possibly make it an option to disable
setDownloadBehaviorwithout having to comment out component code innode_modules?Given that adobe decides the chrome version and panel, this probably wont solve it for me (for a long time anyway): chromiumembedded/cef#3684
A workaround might be if I could set browser.options.name to
electronor something it should skip that part of the component code.huxiang commentedon Mar 3, 2026
Cursor gives me a workaround by patching the
crBrowser.jsfile in playwright module:Before connecting to electron app via CDP, set env var
PW_CHROMIUM_DISABLE_DOWNLOAD_BEHAVIOR=1, then it works.