var page = new WebPage(), t, address; if (phantom.args.length === 0) { console.log('Usage: loadspeed.js '); phantom.exit(); } else { t = Date.now(), address = phantom.args[0], page.open(address, function (status) { if (status !== 'success') { console.log('FAIL to load the address'); } else { t = Date.now() - t; console.log('Page title is ' + page.evaluate(function () { return document.title; })); console.log('Loading time ' + t + ' msec'); } phantom.exit(); }); }