chrome-launcher
chrome-launcher copied to clipboard
Get remote debugging url
I have this:
const cl = require('chrome-launcher');
const util = require('util');
cl.launch({
startingUrl: `http://yahoo.com`,
chromeFlags: ['--auto-open-devtools-for-tabs', '--debug-devtools'],
enableExtensions: true
})
.then(c => {
console.log(util.inspect(c));
// const url = c.getWebSocketServerUrl()
});
I am looking to get access to the url of the websocket server in the browser to connect to, note that if I use these chrome flags
chromeFlags: ['--auto-open-devtools-for-tabs', '--remote-debugging-port=9222'],
the Promise callback will never fire with the above chrome flags!
if you look at this issue: https://github.com/GoogleChrome/puppeteer/issues/1788
the way to get the remote debugging url, is with:
https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#browserwsendpoint
browser.wsEndpoint()
returns:
Browser websocket url. Browser websocket endpoint which can be used as an argument to puppeteer.connect. The format is ws://${host}:${port}/devtools/browser/
my question is: is there a way to retrieve the remote debugging url given a launched chrome instance using chrome-launcher if we use the '--remote-debugging-port=9222' flag?
Is this possible? I also have this problem, as I'd like to get the Chrome remote debug URL from inside Electron, so that I can run tests. I asked about it in Atom forums too: https://discuss.atom.io/t/how-do-i-get-chromes-remote-devtools-debugging-url/64167
You can access the ws endpoint by navigating to the metadata which is exposed on the same debugging port
http://localhost:9222/json/version
More info on the available endpoints here: https://chromedevtools.github.io/devtools-protocol/
Thank You !~