Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

How can I save the "javascript-rendered" page?

Thanks.

like image 766
user420667 Avatar asked Apr 13 '12 16:04

user420667


People also ask

How do you show responses in HTML?

This HTML Response object can then be used in an Optimizer policy to present the webpage. To create an HTML Response object all you need is a name and the html for the webpage. Use the following instructions to create an HTML Response object. Go to Configuration > Objects > HTML Response.

How do I copy a rendered HTML?

Rendered Code There, right-click on the opening <html> tag of the code, and select Copy > Copy outerHTML. You can then paste this in to a new text file as well.


1 Answers

In Chrome (and apparently Firefox), there is a special copy() method that will copy the rendered content to the clipboard. Then you can do whatever you want by pasting it to your preferred text editor.

https://developers.google.com/chrome-developer-tools/docs/commandline-api#copyobject

Console Example:

copy(document.body.innerHTML); 

Note: I noticed Chrome reports undefined after the method is run, however, it seems to execute correctly and the right content is in the clipboard.

like image 125
Grant Avatar answered Oct 04 '22 08:10

Grant