All you have to do is use page.content
var page = require('webpage').create(); page.onError = function(msg, trace) { //prevent js errors from showing in page.content return; }; page.open('http://www.httpuseragent.org', function () { console.log(page.content); //page source phantom.exit(); });
Hessam
source share