chrome-launcher icon indicating copy to clipboard operation
chrome-launcher copied to clipboard

Get remote debugging url

Open ORESoftware opened this issue 7 years ago • 3 comments

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?

ORESoftware avatar Jan 12 '18 05:01 ORESoftware

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

trusktr avatar Apr 06 '19 00:04 trusktr

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/

cado1982 avatar Dec 05 '19 23:12 cado1982

image Thank You !~

lk01mg67 avatar Jul 09 '22 08:07 lk01mg67