Chrome extensions
How to load and test Chromium extensions with Playwright using a persistent context and extension-specific fixtures.
Chromium only
Chrome extension testing is a Chromium-specific scenario. Extensions need a persistent browser context and custom launch arguments that point to the unpacked extension directory.
Use the bundled chromium channel when loading extensions. Google Chrome and Microsoft Edge removed the command-line flags Playwright needs for side-loading extensions.
Launch an extension
Launch a persistent context with --disable-extensions-except and --load-extension. For Manifest V3 extensions, wait for the extension service worker and derive the extension id from its URL.
Create a test fixture
For Playwright Test, wrap the persistent context and extension id in fixtures. Tests can then open the extension popup or verify the extension effect on normal pages.