Repository navigation
Description
Version
1.64.1
Steps to reproduce
- Clone https://github.com/aik099/playwright-disable-features-repro
npm installnpx playwright install chromiumnpx playwright test
The same test runs in two projects. The only difference is launchOptions: { args: ['--disable-features=WebOTP'] } in the second one. It checks that a cross-site iframe still shares localStorage with its first-party site, which holds because Playwright disables ThirdPartyStoragePartitioning (#32230).
Expected behavior
Both projects pass. A user --disable-features adds to the features Playwright disables, the way ChromeDriver handles it: enable-features, disable-features, enable-blink-features and disable-blink-features (joined with ,) and js-flags (joined with a space) are treated as multi-valued, and every occurrence is merged, ChromeDriver's own defaults included (kMultivaluedSwitches / SetMultivaluedSwitch()).
Actual behavior
The with --disable-features=WebOTP project fails, because the iframe gets partitioned storage:
[with --disable-features=WebOTP] › tests/disable-features.spec.ts:5:5 › cross-site iframe shares storage with its first-party site
Expected: "first-party value"
Received: null
Chromium keeps only the last value of a repeated switch, and Playwright puts its own --disable-features=... from chromiumSwitches.ts before the user args. chrome://version shows both:
--disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,...,msEdgeUpdateLaunchServicesPreferredVersion
--disable-features=WebOTP
so all 18 of Playwright's entries are dropped without a warning, including the redirect/interception workarounds (BlockOriginHeaderModificationOnRedirect, AvoidCorsURLLoaderRestartOnRedirect).
Additional context
The last-value-wins part on its own, with two features visible from JS ("OTPCredential" in window, "xr" in navigator):
args |
WebOTP | WebXR |
|---|---|---|
--disable-features=WebOTP |
off | on |
--disable-features=WebOTP, --disable-features=WebXR |
on | off |
--disable-features=WebOTP,WebXR |
off | off |
Same results with chromium-headless-shell and channel: 'chromium', on macOS and Linux arm64.
A merge would fit in chromium.ts, where the user args are appended (chromeArguments.push(...args)). The current workaround is to copy Playwright's list into your own --disable-features value and keep it in sync on every upgrade.
I'd like to work on this if the approach is OK.
Environment
System:
OS: macOS 26.7
CPU: arm64
Binaries:
Node: 26.11.1
npm: 11.20.0
npmPackages:
@playwright/test: 1.64.1 => 1.64.1
Activity
dcrousso commentedon Oct 21, 2026
Hi, the Playwright bot reviewed the 1.64.1 and current main source on my behalf.
Automatic feature list merging needs an API design decision. Playwright appends custom
argsafter its defaults, and Chromium uses the last occurrence of a switch. Theargsdocumentation warns that custom arguments can break Playwright functionality: https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-args.A custom
--disable-featuresvalue therefore replaces the default list, including the storage partitioning workaround. ChromeDriver explicitly combines these values; Playwright currently does not. Changing that precedence would also affect configurations that replace defaults intentionally. The related feature options proposal, #36746, was closed without merging.This was a source review. No browser tests were run.
aik099 commentedon Oct 21, 2026
Thanks for looking into it. Fair point that changing how
argsworks could break setups that replace the defaults on purpose. I can't tell how many there are, but I agree it shouldn't change silently.It's easy to hit without knowing, though. Playwright PHP adds its own
--disable-features=VizDisplayCompositortoargson every Chromium launch, so all of its users run without Playwright's defaults (playwright-php/playwright#190). The repro from this issue returnsnullthere even without any extra args.--disable-featuresis just the most visible case. ChromeDriver merges the same way for all switches that hold a list:--enable-features,--disable-features,--enable-blink-features,--disable-blink-features(joined with,) and--js-flags(joined with a space). Playwright's defaults already include--enable-features=CDPScreenshotNewSurface, so a user--enable-featuresdrops that one too. And two of these switches in the userargsthemselves also keep only the last.A few options that leave
argsas it is:args, the way ChromeDriver does.chromiumDisableFeatures/chromiumEnableFeaturesfrom feat: chromium{Enable,Disable}Features launch options #36746, extended to the other switches. I asked there why it was closed.argsreplaces one of the default switches.defaultArgs()), so the values can be merged by hand without copying them.I'm happy to work on whichever one you prefer.
Turn off Chrome's port randomization on Windows