Extract the current DOM and print it as a string, with styles intact

前端 未结 8 1665
执笔经年
执笔经年 2020-12-07 08:19

I\'d like to be able to take my DOM, as is, and convert it to a string. Let\'s say I open up the inspector and make a change to the margin-left property of a particular ele

8条回答
  •  没有蜡笔的小新
    2020-12-07 08:57

    Chrome feature - Printing the DOM:
    The --dump-dom flag prints document.body.innerHTML to stdout:

    chrome --headless --disable-gpu --dump-dom https://www.chromestatus.com/
    

    Read more

提交回复
热议问题