from phantomjs console typed
var page = require('webpage').create();page.open('http://phantomjs.org', function (status) {console.log(page.title);});
it doesn't print page title undefined
why ?
firstly require("webpage")
not phantomjs' module, that's incorrect.
try use outlined in documentation :
https://github.com/amir20/phantomjs-node
var phantom = require('phantom'); var sitepage = null; var phinstance = null; phantom.create() .then(instance => { phinstance = instance; return instance.createpage(); }) .then(page => { sitepage = page; page.open('http://phantomjs.org', function(){ console.log("title : " + page.title); }); return ; })
Comments
Post a Comment