How to drop more than <body> on chrome / chrome without a head?
The Chrome documentation contains:
The --dump-dom flag prints document.body.innerHTML to stdout:
As the title says, how can I remove a DOM object (ideally everything) using Chromium without a head? I can manually save the entire DOM using the developer tools, but I want a software solution.
Update 2017-10-29 Chrome already has the -dump-html flag, which returns full HTML, not just the body.
v62 has it, it is already on a stable channel.
, : https://bugs.chromium.org/p/chromium/issues/detail?id=752747
( ) https://www.chromestatus.com/features/schedule
Google Chrome. , html, , , .
, . ,
connection resetno chrome found to kill. .
--dump-domhtml, ,curl. , SPA, , JS. google chrome .
--dump-htmlhtml. Google , .Chrome, , "", Google:
https://bugs.chromium.org/p/chromium/issues/detail?id=752747
, , : https://peter.sh/experiments/chromium-command-line-switches/ .
Google, :
const CDP = require('chrome-remote-interface'); ... (async function() { const chrome = await launchChrome(); const protocol = await CDP({port: chrome.port}); // Extract the DevTools protocol domains we need and enable them. // See API docs: https://chromedevtools.imtqy.com/devtools-protocol/ const {Page, Runtime} = protocol; await Promise.all([Page.enable(), Runtime.enable()]); Page.navigate({url: 'https://www.chromestatus.com/'}); // Wait for window.onload before doing stuff. Page.loadEventFired(async () => { const js = "document.querySelector('title').textContent"; // Evaluate the JS expression in the page. const result = await Runtime.evaluate({expression: js}); console.log('Title of page: ' + result.result.value); protocol.close(); chrome.kill(); // Kill Chrome. }); })();: https://developers.google.com/web/updates/2017/04/headless-chrome