I'm trying to find the easiest way to disable javascript when running in headless mode.
I tried running in non-headless mode while setting --user-data-dir, disabling javascript through the normal content settings, and then continuing to use the same user-data-dir when running in headless (hoping that setting would be used regardless of whether I was running in headless or not). The setting did not seem to be respected in headless mode (though it did appear to keep working when I wasn't in headless).
I've also had decent success in using Network.setRequestInterception for documents, manually requesting said documents on the server side, parsing the document with an HTML parser, and then programmatically stripping all script nodes, and then manually continuing the request with the new response. This mostly works, but is complicated, and isn't 100% foolproof (things like onload properties still slip by, etc).
I have not noticed anything else in the protocol docs relating to this. Any guidance would be most welcome.
-Jeremy