Created
October 9, 2015 00:11
-
-
Save jdlrobson/99b0ea3c1c9e05e181c1 to your computer and use it in GitHub Desktop.
File for generating a job using api on Webpagetest.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var WebPageTest = require('webpagetest'); | |
var url = 'http://wikipedia.org/'; | |
var tLocation = 'Dulles.2G'; | |
var key = 'YourKey'; | |
var wbtInstance = 'http://www.webpagetest.org/'; | |
var wpt = new WebPageTest( wbtInstance, key ); | |
wpt.runTest(url, { | |
runs: 9, | |
firstViewOnly: true, | |
connectivity: '2G', | |
location: tLocation | |
}, function(err, data) { | |
if ( err ) { | |
console.log( 'ERROR: ' + err ); | |
} else if ( data.statusCode !== 200 ) { | |
console.log( 'ERROR: ' + data.statusCode ); | |
} else { | |
try{ | |
console.log( data.data.jsonUrl ); | |
} catch( e) { | |
console.log( 'ERROR:', data ); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment