Created
March 12, 2017 09:04
-
-
Save vitorio/52cf78c6b28423994434d728ac0eb4f9 to your computer and use it in GitHub Desktop.
ES5- and ES6-injecting shims for PhantomJS Emularity test, shims from https://github.com/es-shims/es5-shim and http://stackoverflow.com/a/38471938
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
// | |
// | |
// Script to run against emulator/emularity pages to do screengrabs. | |
// | |
var webPage = require('webpage'); | |
var page = webPage.create(); | |
page.onConsoleMessage = function(msg, lineNum, sourceId) { | |
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")'); | |
}; | |
page.onInitialized = function() { | |
console.log("onInitialized"); | |
if(page.injectJs('es5-shim.min.js')){ | |
console.log("es5-shim"); | |
if(page.injectJs('es5-sham.min.js')){ | |
console.log("es5-sham"); | |
if(page.injectJs('json3.min.js')){ | |
console.log("json3"); | |
if(page.injectJs('es6-shim.min.js')){ | |
console.log("es6-shim"); | |
if(page.injectJs('es6-sham.min.js')){ | |
console.log("es6-sham"); | |
if(page.injectJs('core.js')){ | |
console.log("core"); | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
page.open('https://archive.org/details/msdos_shareware_fb_PCM350', function () { | |
setTimeout(function() { | |
// Initial frame | |
var frame = 0; | |
// Add an interval every 25th second | |
setInterval(function() { | |
// Render an image with the frame name | |
page.render('frames/screenshot'+(frame++)+'.png', { format: "png" }); | |
// Exit after 50 images | |
if(frame > 50) { | |
phantom.exit(); | |
} | |
}, 2500); | |
}, 666); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment