Is anyone currently using playwright to test chrome extensions? I’m trying to do this at work and having a lot of issues. Googling this I’m finding some resources but not many. I’m basically trying to use the code from the playwright docs to get it working. https://playwright.dev/docs/chrome-extensions Bonus points if you’re using python but happy to discuss in js or ts.
This thread is trying to answer question "Is anyone currently using playwright to test chrome extensions?"
const worker = context.serviceWorkers()[0] ?? await context.waitForEvent('serviceworker');
// wait for initialization
await worker.evaluate(() => new Promise<void>((resolve, reject) => {
if (serviceWorker.state !== 'activated') {
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state === 'activated') resolve();
});
serviceWorker.addEventListener('error', reject);
} else {
resolve();
}
}));
We’re also using V3 but the python documentation at least has the recommended service workers. Have you found any other good info sources on working with extensions in playwright? I’ve found a couple articles but not a lot. Once the kiddo is asleep I’ll check out your code more closely to see what I can glean.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].