arrow-left Back to topicQuizChrome extensionsCheck yourself1.Why can't you test Chrome extensions with Google Chrome or Microsoft Edge in Playwright?Those browsers don't support extensions at all.They removed the command-line flags Playwright needs to side-load an unpacked extension.Playwright only supports Chromium for all testing scenarios.Extensions require a persistent context which only Chromium provides.2.Which browser launch method is required when testing extensions, and why?browser.newContext() — it supports extra launch arguments.chromium.launch() with args — standard launch with custom flags.chromium.launchPersistentContext() — extensions require a persistent user data directory.chromium.connect() — extensions are loaded via a remote browser.3.How do you obtain the extension ID for a Manifest V3 extension after launching the context?Read it from the extension's manifest.json file.Wait for the extension service worker event and parse the ID from its URL.Call context.extensionId() after the context is created.Read the chrome.runtime.id via page.evaluate().4.What are the two required args you must pass to launchPersistentContext to load an unpacked extension?--enable-extensions and --extension-path--load-extension and --allow-extensions--disable-extensions-except and --load-extension--no-sandbox and --load-extension5.In a test fixture for extensions, which fixture provides the context and which derives the extension ID from it?extensionId provides the context; context derives the ID.context launches the persistent context; extensionId waits for the service worker and extracts the ID from the context.Both fixtures are independent and do not reference each other.A single combined fixture returns both the context and the ID.6.After getting the extension ID, how do you open the extension popup page in a test?Click the extension icon in the browser toolbar.Call browser.openExtension(extensionId) with the ID.Navigate to chrome-extension://<extensionId>/<popup-file>.html with page.goto().Use context.newPage() with { extensionId } option.7.Which channel value must you set in launchPersistentContext for extension testing?'chrome''chromium''msedge'No channel is needed; it defaults to the correct one.8.What does context.waitForEvent('serviceworker') return in the extension fixture?A Page object representing the service worker tab.A Worker object whose .url() contains the extension ID.A boolean indicating whether the service worker registered successfully.The extension manifest as a JSON object.Submit answersarrow-left PreviousService WorkersTouch events (legacy)Next arrow-right