BlueGit

blue-star danique-bot

Files

danique-bot / node_modules / phantomjs-prebuilt / test / loadspeed.js

loadspeed.js

Import template
timfa Tim · pushed by timfa · 4 years ago
c788ad20 History
loadspeed.js 552 B Download Raw
1// phantomjs test script
2// opens url and reports time to load
3// requires an active internet connection
4var page = require('webpage').create()
5var system = require('system')
6var t
7var address
8
9if (system.args.length === 1) {
10 console.log('Usage: loadspeed.js <some URL>')
11 phantom.exit()
12}
13
14t = Date.now()
15address = system.args[1]
16page.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})