Bug fixes, async support, debug/verbose mode
- significant bug fixes for PhantomJS users
- bug fix for Windows users (no longer directly use
pwd
commands) - bug fix for CasperJS users (can now use ID selectors - the hashtag symbol is escaped before being passed to CLI)
- validation, giving users helpful error messages if they try to misuse Wraith
- expanded test suite (
construct_command
tests, validation tests) - better default example configs and before_capture hooks
- asynchronous support for the before_capture hook. This introduces a breaking change (see next section)
- verbose mode (just add
verbose: true
to your config. Easier debugging) - all logging moved to a logger class
- 'debug' functionality (built into verbose mode). Starts off the output of all commands with system-specific information which should help with debugging, e.g.
#################################################
Wraith version: 3.0.4
Ruby version: ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.1.0]
ImageMagick: Version: ImageMagick 6.9.1-3 Q16 x86_64 2015-05-25 http://www.imagemagick.org
PhantomJS version: 1.9.8
CasperJS version: 1.0.0
#################################################
Breaking changes
The new before_capture
hook was great, but didn't support asynchronous actions such as AJAXing in content, etc, as Wraith's internal snap file would simply run the before_capture module and then continue, assuming the code was executed instantly.
Now, an additional parameter (the ready
callback function) is passed to the before_capture module, which explicitly requires the module to call the callback before Phantom/Casper will continue. This means the user can put in arbitrary wait times, or perform any other asynchronous action, only calling the callback when they're ready.
module.exports = function (casper, ready) {
// make Wraith wait a bit longer before taking the screenshot
casper.wait(2000, ready); // you MUST call the ready() callback for Wraith to continue
}