Save and render a webpage with PhantomJS and node.js

From your comments, I’d guess you have 2 options

  1. Try to find a phantomjs node module –
  2. Run phantomjs as a child process inside node –


It seems the child process is suggested by phantomjs as a way of interacting with node, see faq –


Example Phantomjs script for getting the pages HTML markup:

var page = require('webpage').create();'', function (status) {
    if (status !== 'success') {
        console.log('Unable to access network');
    } else {
        var p = page.evaluate(function () {
            return document.getElementsByTagName('html')[0].innerHTML

Leave a Comment