Created
May 26, 2016 21:00
-
-
Save CodeDotJS/8748028980910a04633429b1639914e4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'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