Skip to content

Instantly share code, notes, and snippets.

@CodeDotJS
Created May 26, 2016 21:00
Show Gist options
  • Save CodeDotJS/8748028980910a04633429b1639914e4 to your computer and use it in GitHub Desktop.
Save CodeDotJS/8748028980910a04633429b1639914e4 to your computer and use it in GitHub Desktop.
'use strict';
const jsdom = require('jsdom');
jsdom.env({
url: 'http://fast.com/',
scripts: ['http://code.jquery.com/jquery.js'],
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36',
strictSSL: false,
features: {
FetchExternalResources: ['script'],
ProcessExternalResources: ['script']
},
done: (err, window) => {
if (err) {
throw err;
}
setTimeout(() => {
console.log('Speed:', window.$('#speed-value').text().trim(), window.$('#speed-units').text().trim());
}, 5000);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment