The Osirium PAM casper module
This section covers:
Osirium PAM provides a custom module to aid in the development of CasperJS tasks. The library makes it easy to write CasperJS tasks that adhere to Osirium PAM expected standard.
By default, Osirium PAM expects that parameters will be passed into the task on stdin. For testing, it is possible to hard code the parameters.
The first thing that a CasperJS task will do is load parameters. This can be done in two ways: hard coding, or receiving them through stdin at runtime.
To hard code your parameters, add an "osirium" section to the CasperJS standard options object before you require the Osirium PAM module.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
For use within Osirium PAM parameters must be read from stdin. This is carried out automatically when importing the Osirium PAM module, so your file can simply look like this:
It is not required to store a reference to the Osirium PAM as a variable: it attaches functions to the casper object.
Whichever method you use, your task parameters will be available through
description (str) : A short description of the screenshot. Added to the screenshot file name.
logLevel (str) : Optional argument dictating the log level at which this screenshot should be displayed. Default is DEBUG.
Save a screenshot of the page that Casper is currently seeing to the task log directory, if the current log level is equal to the given logLevel.
Screenshots will be visible in the task log.