The PxM Platform casper module
This section covers:
The PxM Platform provides a custom module to aid in the development of CasperJS tasks. The library makes it easy to write CasperJS tasks that adhere to the PxM Platform expected standard. By default, the PxM Platform 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 PxM Platform 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 PxM Platform 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 the PxM Platform parameters must be read from stdin. This is carried out automatically when importing the PxM Platform module, so your file can simply look like this:
It is not required to store a reference to the PxM Platform 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.