Firefox has a remote debugger feature. https://docs.firefox-dev.tools/backend/protocol.html
The debugger is available via socket or WebSocket when we launch a Firefox with --start-debugger-server argument like firefox --start-debugger-server ws:9090. Then, WebSocket clients can connect to it. But the command protocol is not CDP (Chrome DevTools Protocol). The format also Firefox specific (and not on the documentation well?)
I wondered why Puppeteer and Playwright communicated with Firefox over debugger protocol. Then, I noticed a remote project https://wiki.mozilla.org/Remote . It is available in the Nightly build. So, the both project required the nightly build for Firefox.
- https://github.com/puppeteer/puppeteer/tree/master/experimental/puppeteer-firefox
- https://github.com/microsoft/playwright/blob/master/src/server/firefox.ts
Launch the nightly build with -remote-debugger argument:
$ /Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin --remote-debugger localhost:9222
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
DevTools listening on ws://localhost:9222/devtools/browser/57e02a1d-c670-cd44-a26a-d08a6cf2acb
Send a command over WebSocket to the instance.
$ wscat -c ws://localhost:9222/devtools/browser/57e02a1d-c670-cd44-a26a-d08a6cf2acb7
Connected (press CTRL+C to quit)
> {"id":1,"method":"Browser.getVersion","params":{}}
< {"id":1,"result":{"protocolVersion":"1.3","product":"Firefox","revision":"1","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Firefox/78.0","jsVersion":"1.8.5"}}
It does not support /json paths yet. (It returned 404). So tCDP support does not mean Chrome Devtools built in Chrome support, but it is very promising.