node-horseman
Advanced tools
Comparing version 2.2.0 to 2.2.1
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
##2.2.1 - 2015-10-01 | ||
### Fixed | ||
- `.waitFor` bug fix. Closes #45. | ||
##2.2.0 - 2015-09-29 | ||
@@ -5,0 +9,0 @@ ### Added |
@@ -47,6 +47,7 @@ var fs = require("fs"); | ||
var self = this; | ||
debug('.open ' + url); | ||
return this.ready.then(function() { | ||
return new Promise(function(resolve, reject) { | ||
self.page.open(url, function(err, status) { | ||
debug('.open ' + url); | ||
debug('.open complete'); | ||
if (err) reject(err); | ||
@@ -331,2 +332,3 @@ else resolve(status); | ||
}, selector, function(err) { | ||
debug('.click() done'); | ||
if (err) throw err; | ||
@@ -421,3 +423,3 @@ else resolve(); | ||
var self = this; | ||
debug('.pdf()',path,paperSize); | ||
if (!paperSize) { | ||
@@ -437,3 +439,3 @@ paperSize = { | ||
}, function() { | ||
debug('.pdf() saved to ' + path); | ||
debug('.pdf() complete'); | ||
resolve(); | ||
@@ -956,2 +958,3 @@ }); | ||
if (self.waitingForNextPage === false) { | ||
debug('.waitForNextPage() completed successfully'); | ||
clearInterval(waiting); | ||
@@ -961,3 +964,3 @@ resolve(); | ||
var diff = Date.now() - start; | ||
if (diff > self.options.timeout) { | ||
if (diff > self.options.timeout) { | ||
clearInterval(waiting); | ||
@@ -981,3 +984,3 @@ reject('Timeout occurred before url changed.'); | ||
exports.waitForSelector = function(selector) { | ||
debug('waitForSelector()', selector); | ||
debug('.waitForSelector()', selector); | ||
eval("var elementPresent = function() {" + | ||
@@ -987,7 +990,9 @@ " var element = document.querySelector('" + selector + "');" + | ||
"};"); | ||
return this.waitFor(elementPresent, true); | ||
return this.waitFor(elementPresent, true).then(function(){ | ||
debug('.waitForSelector() complete'); | ||
}); | ||
}; | ||
exports.waitFor = function(fn, value) { | ||
debug('waitFor()'); | ||
debug('.waitFor()'); | ||
var self = this; | ||
@@ -1000,3 +1005,3 @@ | ||
start = Date.now(); | ||
checkInterval = setInterval(function() { | ||
var checkInterval = setInterval(function() { | ||
var diff = Date.now() - start; | ||
@@ -1011,2 +1016,3 @@ if (diff > self.options.timeout) { | ||
if (res === value) { | ||
debug('.waitFor() completed successfully'); | ||
clearInterval(checkInterval); | ||
@@ -1021,2 +1027,3 @@ resolve(); | ||
if (err === 'Timeout occurred before url changed.') { | ||
debug('Timeout during waitFor()'); | ||
if (typeof self.page.onTimeout === 'function') { | ||
@@ -1023,0 +1030,0 @@ self.page.onTimeout(); |
@@ -40,2 +40,3 @@ var clone = require('clone'); | ||
horseman.waitingForNextPage = false; | ||
debug('phantomjs onLoadFinished triggered.'); | ||
if (options.injectJquery) { | ||
@@ -90,3 +91,3 @@ var self = this; | ||
debug('.setup() creating phantom instance on'); | ||
debug('.setup() creating phantom instance on %s',this.options.port); | ||
@@ -93,0 +94,0 @@ var phantomOptions = { |
{ | ||
"name": "node-horseman", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Run PhantomJS from Node", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168606
2633