This's a library that promisify phantomjs-node. You don't need to install either phantomjs-node nor phantomjs. Require it, then it will Promises/A+ compliant.
Based on bluebird.
var phantom = require("phantomjs-promise");
phantom.createAsync().then(function (phantom) {
return phantom.createPageAsync();
}).then(function (objects) {
return objects.page.setAsync('viewportSize', {
width: 100,
height: 100
});
}).then(function (objects) {
return objects.page.openAsync("./test/test.html");
}).then(function (objects) {
if (objects.ret[0] != "success") {
throw objects.ret[0].status;
}
return objects.page.renderAsync(saveFileName);
}).then(function (objects) {
objects.page.close();
objects.phantom.exit();
});
mocha
The MIT License