var webpage = require(‘webpage‘);
var page = webpage.create();
var system = require(‘system‘);
var t,address;
if(system.args.length === 1){
console.log(‘Usage:page.js <some url>‘);
phantom.exit();
}
t = Date.now();
address = system.args[1]
page.open(address,function(s){
if (s == "success") {
t = Date.now() - t;
console.log(‘loading ‘ + t);
}else{
console.log(‘fail‘);
}
phantom.exit();
});本文出自 “素颜” 博客,请务必保留此出处http://suyanzhu.blog.51cto.com/8050189/1900444
原文:http://suyanzhu.blog.51cto.com/8050189/1900444