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 customizing BrowserContextOptions when chromium.connectOverCDP #37627
When calling chromium.connectOverCDP(endpoint) to an existing browser, Playwright enforces the colorScheme to be light regardless of the page's original. This is somehow unexpected since "connecting" to an "existing" thing should not override its "own" behavior.
In #28824 this has been discussed - forcing "light" scheme is for consistency, which is also reasonable. However I think at least there should be an escape hatch in connectOverCDP that allows to bypass this, for example, allow it to accept BrowserContextOptions and merge it with the defaults.
Currently users can only iterate through all pages and emulateMedia on each, which leads to unavoidable light-to-dark UI flickers.
Example
Open a webpage that listens the perfers-color-scheme from OS.
<!DOCTYPE html><htmllang="en"><head><style>span{display: none;}.light{display: inline;}@media(prefers-color-scheme: dark){.light{display: none;}.dark{display: inline;}}</style></head><body><div>
Current prefers-color-scheme:
<spanclass="light">light</span><spanclass="dark">dark</span></div></body></html>
Activity
pavelfeldman commentedon May 12, 2026
There is a new noDefaults options in connectOverCDP, I hope it works for you!