I'm using PhantomJS to get the generated source of a web page after JavaScript DOM manipulations have taken place. This web page has JUST a <body>
and nothing else.
Important: This web page uses browser's localStorage
to generate the page.
I want to change LocalStorage in PhantomJS before opening the page.
App.js:
var page = require('webpage').create();
page.open("https://sample.com")
setTimeout(function(){
// Where you want to save it
page.render("screenshoot.png")
// You can access its content using jQuery
var fbcomments = page.evaluate(function(){
return $("body").contents().find(".content")
})
phantom.exit();
}, 1000)