Commit 86b650c0 86b650c085ae25f21912fb047b724d5481301e68 by Nicolas Perriault

added Casper.reload()

1 parent 9910b9dd
......@@ -17,6 +17,7 @@ XXXX-XX-XX, v1.0
- added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string
- added [`Tester.assertTitleMatch()`](http://casperjs.org/api.html#tester.assertTitleMatch) method
- added [`utils.getPropertyPath()`](http://casperjs.org/api.html#utils.getPropertyPath)
- added [`Casper.reload()`](http://casperjs.org/api.html#casper.reload)
- added experimental support of custom headers sending in outgoing request (refs [#137](https://github.com/n1k0/casperjs/issues/137) - PhantomJS 1.6 required)
- switched to more standard `.textContent` property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsers
- casper modules now all use [javascript strict mode](http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/)
......
Subproject commit 26b6e8aebd0ddeb877963b3f6e3721883b97fab9
Subproject commit dd54a24e01c379ad5b34dfb2ec11323a95a7e25f
......
......@@ -884,6 +884,26 @@ Casper.prototype.open = function open(location, settings) {
};
/**
* Reloads current page.
*
* @param Function then a next step function
* @return Casper
*/
Casper.prototype.reload = function reload(then) {
"use strict";
if (!this.started) {
throw new CasperError("Casper not started, can't reload()");
}
this.evaluate(function() {
window.location.reload();
});
if (then && utils.isFunction(then)) {
this.then(this.createStep(then));
}
return this;
};
/**
* Repeats a step a given number of times.
*
* @param Number times Number of times to repeat step
......