2011-09-13 00:17:54 +04:00
|
|
|
page = require('webpage').create()
|
2011-05-26 13:05:03 +04:00
|
|
|
|
|
|
|
if phantom.args.length is 0
|
|
|
|
console.log 'Usage: loadspeed.js <some URL>'
|
|
|
|
phantom.exit()
|
2011-04-22 19:39:51 +04:00
|
|
|
else
|
2011-05-26 13:05:03 +04:00
|
|
|
t = Date.now()
|
|
|
|
address = phantom.args[0]
|
|
|
|
page.open address, (status) ->
|
|
|
|
if status isnt 'success'
|
|
|
|
console.log('FAIL to load the address')
|
2011-04-22 19:39:51 +04:00
|
|
|
else
|
2011-05-26 13:05:03 +04:00
|
|
|
t = Date.now() - t
|
|
|
|
console.log('Page title is ' + page.evaluate( (-> document.title) ))
|
|
|
|
console.log('Loading time ' + t + ' msec')
|
2011-04-22 19:39:51 +04:00
|
|
|
phantom.exit()
|
2011-05-26 13:05:03 +04:00
|
|
|
|