phantomjs-promise
v0.0.1
Published
Promisify Phantomjs with Bluebird
Downloads
8
Readme
Phantomjs-promise
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.
Usage
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();
});
Test
mocha
License
The MIT License