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

is it possible to launch a dev-tools url?

Open craigmulligan opened this issue 7 years ago • 4 comments

I'm trying to launch chrome with a dev-tools socket url, but it doesn't work, if I manually enter the URL in then it does, I assume this has to do with the custom dev-tools protocol?

Do you have any suggestions on how to programmatically open a dev-tools URL, for example: chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=0.0.0.0:9222/e954b542-f175-4639-bcc9-2ec64f477123.

craigmulligan avatar Jan 22 '18 22:01 craigmulligan

I have the same problems. Anyone have any suggestion about this?

navono avatar Feb 06 '18 05:02 navono

Any update?

fpsqdb avatar Apr 18 '19 10:04 fpsqdb

The straightforward ways of doing this don't work, due to security concerns.

I believe the only way is using the protocol itself (Page.navigate)

paulirish avatar Apr 18 '19 16:04 paulirish

Got it, it's on this url http://localhost:9222/json/version so you can curl or create a request.

'use strict';
const chromeLauncher = require('chrome-launcher');
const fetch = require('node-fetch');

(async () => {
  const chrome = await chromeLauncher.launch({
    headless: true,
    port: 9222
  });

  const request = await fetch('http://localhost:9222/json/version');
  const webSocketDebuggerUrl = (await request.json()).webSocketDebuggerUrl;

  console.log(webSocketDebuggerUrl);
  // do stuff
})();

boriscosic avatar May 08 '19 21:05 boriscosic