Get the html of the javascript-rendered page (after interacting with it)

前端 未结 4 382
感情败类
感情败类 2021-01-30 14:16

I would like to be able to save the state of the html page after I\'ve interacted with it.

Say I click a checkbox, or the javascript set the values of various elements.<

4条回答
  •  时光取名叫无心
    2021-01-30 14:48

    To get the equivalent of view source with javascript rendered, including doctype and html tags, copy the command into the chrome console:

    console.log(new XMLSerializer().serializeToString(document.doctype) + document.getElementsByTagName('html')[0].outerHTML);
    

    In the chrome console, hover at the end of the output and click on the copy link to copy to the pasteboard.

提交回复
热议问题