我开始使用Grunt并希望将变量传递给我通过exec运行的PhantomJS脚本.我希望能够做的是传递一个url,让脚本从中获取屏幕截图.任何帮助将不胜感激,谢谢!
达伦
Grunt脚本
exec('phantomjs screenshot.js',
function (error, stdout, stderr) {
// Handle output
}
);
Run Code Online (Sandbox Code Playgroud)
screenshot.js
var page = require('webpage').create();
page.open('http://google.com', function () {
page.render('google.png');
phantom.exit();
});
Run Code Online (Sandbox Code Playgroud)