Skip to content

Instantly share code, notes, and snippets.

@windse7en
Created May 11, 2017 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save windse7en/db016325112fe2b56363a4de10418027 to your computer and use it in GitHub Desktop.
Save windse7en/db016325112fe2b56363a4de10418027 to your computer and use it in GitHub Desktop.
test js file for phantomjs
// phantomjs --remote-debugger-port=9000 --remote-debugger-autorun=true test.js urlPath
/*
* screenshot will be created in the cwd.
*/
var page = new WebPage();
var system = require('system');
var url = 'http://localhost:8080/#/tests/' + system.args[1];
function takeScreenshot() {
setTimeout(function() {
page.render('screenshot.png');
}, 1000);
}
console.log(url);
page.open(url, function (status) {
console.log(status);
takeScreenshot();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment