Closed mxschmitt closed 2 months ago
Given that this API should already work with the CEF Chrome bootstrap (same code as Google Chrome), and that the CEF Alloy bootstrap will be deleted in a few months (see #3685), I think we can just leave this unimplemented for Alloy and recommend that users start migrating to Chrome.
Sounds good! Is there an easy way of trying out the new CEF Chrome bootstrap mode? cefclient / sefsimple is only using the alloy mode?
Is there an easy way of trying out the new CEF Chrome bootstrap mode?
Yes, just add the --enable-chrome-runtime
command-line flag to cefclient or cefsimple. If using cefsimple, also add --use-views
.
Awesome, just tried it out and it works out of the box. For reference:
// @ts-check
// Requires: './cefclient --remote-debugging-port=1235 --url=about:blank --enable-chrome-runtime
import { chromium } from 'playwright';
process.env.PW_CHROMIUM_ATTACH_TO_OTHER = '1';
(async () => {
const browser = await chromium.connectOverCDP('http://localhost:1235');
const defaultContext = browser.contexts()[0];
const defaultPage = defaultContext.pages()[0];
await defaultPage.goto('http://example.com');
console.log(await defaultPage.title());
console.log(defaultPage.url());
await defaultContext.close();
await browser.close();
})();
Describe the bug
Currently
CefDevToolsManagerDelegate::GetDefaultBrowserContext
is not implemented, this causes the following CDP calls to fail:When implementing the method like done in Electron, things will start working: https://github.com/electron/electron/pull/41738. This also makes it then compatible with Playwright.
There was a quite popular feature request on our side about connecting to CEF instances from Playwright: https://github.com/microsoft/playwright/issues/10927
To Reproduce Steps to reproduce the behavior:
mkdir repro && cd repro && npm init -y && npm install playwright
test.mjs
filenode test.mjs
It throws with
Browser context management not supported
from here.Expected behavior
CDP calls work.
Screenshots
N/A
Versions (please complete the following information):
Additional context
Does the problem reproduce with the cefclient or cefsimple sample application at the same version?
Yes
Does the problem reproduce with Google Chrome at the same version?
No
Add any other context about the problem here.
I'm currently working on a fix.