I'm trying to figure out if it's possible to make Chrome save a site in MHTML from command line. I'm aware of --print-to-pdf, --dump-dom, and --screenshot but neither of them is what I'm after.

Anyone knows the answer to this?

Note: I know how to turn on MHTML option in Chrome.

  • As it states that the normal "Save as HTML" behavior is disabled I'd try to find an option on headless chrome that just saves the HTML?
    – Seth
    Oct 16 '17 at 11:11
  • It's not using headless Chrome, but take a look at this similar question which asks how to accomplish the same thing using wget: Oct 16 '17 at 15:02
  • 1
    wget is not enough, given how much site requires js to render images, thanks to lazy load. Oct 16 '17 at 15:43
  • Related question on Stackoverflow: stackoverflow.com/q/60352003/974555
    – gerrit
    Dec 6 '20 at 16:10

This is an old question and not an elegant solution, but you could probably do this using AutoHotkey to simulate saving manually at the headless machine by passing appropriate keystrokes.

  • Are you sure OP is using a platform which AHGK will run? And that there is an interface to direct the keystrokes to?
    – bertieb
    Jun 30 '19 at 23:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.