Considering WebKit doesn鈥檛 support web extensions, would it be fair to consider this a request for Firefox extension support?
You should be able to load extensions into Firefox though some launch arguments. But we don鈥檛 currently have a way for you to evaluate JavaScript in the extension context.
Yeah, i was mainly thinking about FF
@Banou26 you can already load web extensions to firefox using web-ext - that's the recommended way to load extensions to ff. We explored it a while back here: https://github.com/puppeteer/puppeteer/issues/4162#issuecomment-473131606
Same instructions should work for PlayWright; cc'ing @denar90 who poked a lot into this.
Hope this helps!
Could you kindly share what the expected sequence is to start a playwright-controlled Firefox instance with extensions installed?
I don't quite understand how to trigger all of this from my playwright script.
Should we be overriding executablePath in browser.launch() to point to web-ext and pass its arguments?
I second what @gurupras said.
I'm also very interested in how to use Playwright for testing WebExtensions. I tried the approach above with Playwright but I'm stuck with the following error when running my script:
Error when running playwright script:
WebSocket error: Unexpected server response: 400
=================== firefox.connect logs ===================
<ws connecting> ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/
<ws connect error> ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/ Unexpected server response: 400
<ws disconnected> ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/
============================================================
Here's my code relevant bits:
web-ext confirmation juggler is listening:
[firefox/index.js][debug] Firefox stdout: Juggler listening on ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501
my playwright script:
browser = await browserWrapper.firefox.connect({
wsEndpoint: 'ws://127.0.0.1:1234/',
// also tried with:
// wsEndpoint: 'ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501',
// and:
// wsEndpoint: 'ws://127.0.0.1:1234/c1f80464-a717-b542-92bf-8884ddef3501/',
logger: { // doesn't show any other extra information
isEnabled: () => true,
log: (name, severity, message, args) => console.log(`${name} ${message}`),
},
});
I'm using: "playwright-firefox": "1.1.1"
That's the only missing bit in my quest to fully automate my extension's testing :)
Any ideas how to accomplish testing that? /cc @aslushnikov @denar90
Thank you!
I have also just tried a different approach, without using juggler but rather connecting to the remote debugger as suggested in a different thread. I posted all details here: https://github.com/mozilla/web-ext/issues/1927 (there's details about puppeteer and playwright)
Could you kindly share what the expected sequence is to start a playwright-controlled Firefox instance with extensions installed?
@gurupras @lfilho Oops sorry it took me a while. I posted some details here: https://github.com/mozilla/web-ext/issues/1927#issuecomment-647842800
Most helpful comment
@gurupras @lfilho Oops sorry it took me a while. I posted some details here: https://github.com/mozilla/web-ext/issues/1927#issuecomment-647842800