CasperJS is no longer actively maintained. Navigation scripting and testing utility for PhantomJS and SlimerJS
Next version should be 1.0.0 stable.
Tester.assertField()
method, which can now tests for other field types than input
s.Casper.getCurrentUrl()
could misbehave with encoded urlsCasper.echo()
to print a message to the casper console from the remote DOM environmentCasper.waitForText()
to wait for a given text to be present in page HTML contentsClientUtils.getFieldValue()
injector
module is now deprecated, but kept for backward compatibility purpose.waitTimeout
options, removed defaultWaitTimeout
option.die()
anymore in testsrequire('casper').create().start('http://www.google.fr/', function(response) {
require('utils').dump(response);
}).run();
That gives:
$ casperjs dump-headers.js
{
"contentType": "text/html; charset=UTF-8",
"headers": [
{
"name": "Date",
"value": "Thu, 18 Oct 2012 08:17:29 GMT"
},
{
"name": "Expires",
"value": "-1"
},
// ... lots of other headers
],
"id": 1,
"redirectURL": null,
"stage": "end",
"status": 200,
"statusText": "OK",
"time": "2012-10-18T08:17:37.068Z",
"url": "http://www.google.fr/"
}
To fetch a particular header by its name:
require('casper').create().start('http://www.google.fr/', function(response) {
this.echo(response.headers.get('Date'));
}).run();
That gives:
$ casperjs dump-single-header.js
Thu, 18 Oct 2012 08:26:34 GMT
The documentation has been updated accordingly.
onWaitTimeout
option has been added, to allow defining a default behavior when a waitFor*
function times out.debugHTML()
can have a selector passed; added getHTML()
ClientUtils.getElementsBound()
and Casper.getElementsBound()
Casper.evaluate()
to use phantomjs >= 1.6 native one. As a consequence, the injector
module is marked as deprecated.casper test
commandCasper.currentHTTPStatus
now defaults to null
when resource are loaded using the file://
protocol--no-colors
option to the casper test
command to skip output colorationevent.preventDefault()
was used.Casper.getPageContent()
to access raw page body contents on non-html received content-types.casper selftest
command has been added as well.escape
to encodeURIComponent
for downloading binaries via POSTrun()
calls (more explanations)--pre
and --post
options to the casperjs test
command to load test files before and after the execution of testsuitecasperjs
executableCasper.exit
returned this
after calling phantom.exit()
which may caused PhantomJS to hangClientUtils.getDocumentHeight()
toString()
and status()
methods to Casper
prototype.casper test
command
casper test
now resolves local paths urlsutils.isWebPage()
was brokenClientUtils.fill()
was searching elements globallychange
event after a field value has been setsafeLogs
option to blur password values in debug logs. This option is set to true
by default.
Casper.userAgent()
to ease a more dynamic setting of user-agent stringTester.assertTitleMatch()
methodutils.getPropertyPath()
Casper.captureBase64()
for rendering screen captures as base64 strings - closes #150
Casper.reload()
.textContent
property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsersCasper.download()
not working correctly with binaries//
comments in evaluate() functionDummy
colorizer class, in order to disable colors in console outputCasper.clickLabel()
for clicking on an element found by its innerText
contentAs a side note, the official website monolithic page has been split across several ones: http://casperjs.org/
evaluate()
callerror
event, better error reporting
fill()
coulnd't submit()
a form with a submit input named submit
GET
requestsTester.assertNotEquals()
(@juliangruber)=
(equals sign) were not being parsed properlyCapser.base64encode()
from some eventsos.execvp()
instead of subprocess.Popen()
(@jart):
This patch fixes a bug where casperjs' python launcher process won't pass along kill signals to the phantomjs subprocess. This patch works by using an exec system call which causes the phantomjs subprocess to completely replace the casperjs parent process (while maintaining the same pid). This patch also has the added benefit of saving 10 megs or so of memory because the python process is discarded.
=
(equals sign) were not parsed properlyTester.assertNotEquals
method (@juliangruber)page.initialized
event to where it should have always been, and is now using native phantomjs onInitialized
eventTester.assertSelectorExists
was brokenclear()
method to close a page
You now have to call casper.clear()
if you want to stop javascript execution within the remote DOM environment.fallbackToHref
option handling in ClientUtils.click()
(refs #63)tester.findTestFiles()
now returns results in predictable order--log-level
and --direct
options to casper test
commandbootstrap.js