1 |
|
2 |
|
3 |
|
4 | var page = require('webpage').create()
|
5 | var system = require('system')
|
6 | var t
|
7 | var address
|
8 |
|
9 | if (system.args.length === 1) {
|
10 | console.log('Usage: loadspeed.js <some URL>')
|
11 | phantom.exit()
|
12 | }
|
13 |
|
14 | t = Date.now()
|
15 | address = system.args[1]
|
16 | page.open(address, function (status) {
|
17 | if (status !== 'success') {
|
18 | console.log('FAIL to load the address')
|
19 | } else {
|
20 | t = Date.now() - t
|
21 | console.log('Loading time ' + t + ' msec')
|
22 | }
|
23 |
|
24 | phantom.exit()
|
25 | }) |
\ | No newline at end of file |