added Casper.reload()
Showing
3 changed files
with
22 additions
and
1 deletions
... | @@ -17,6 +17,7 @@ XXXX-XX-XX, v1.0 | ... | @@ -17,6 +17,7 @@ XXXX-XX-XX, v1.0 |
17 | - added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string | 17 | - added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string |
18 | - added [`Tester.assertTitleMatch()`](http://casperjs.org/api.html#tester.assertTitleMatch) method | 18 | - added [`Tester.assertTitleMatch()`](http://casperjs.org/api.html#tester.assertTitleMatch) method |
19 | - added [`utils.getPropertyPath()`](http://casperjs.org/api.html#utils.getPropertyPath) | 19 | - added [`utils.getPropertyPath()`](http://casperjs.org/api.html#utils.getPropertyPath) |
20 | - added [`Casper.reload()`](http://casperjs.org/api.html#casper.reload) | ||
20 | - added experimental support of custom headers sending in outgoing request (refs [#137](https://github.com/n1k0/casperjs/issues/137) - PhantomJS 1.6 required) | 21 | - added experimental support of custom headers sending in outgoing request (refs [#137](https://github.com/n1k0/casperjs/issues/137) - PhantomJS 1.6 required) |
21 | - switched to more standard `.textContent` property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsers | 22 | - switched to more standard `.textContent` property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsers |
22 | - casper modules now all use [javascript strict mode](http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/) | 23 | - casper modules now all use [javascript strict mode](http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/) | ... | ... |
... | @@ -884,6 +884,26 @@ Casper.prototype.open = function open(location, settings) { | ... | @@ -884,6 +884,26 @@ Casper.prototype.open = function open(location, settings) { |
884 | }; | 884 | }; |
885 | 885 | ||
886 | /** | 886 | /** |
887 | * Reloads current page. | ||
888 | * | ||
889 | * @param Function then a next step function | ||
890 | * @return Casper | ||
891 | */ | ||
892 | Casper.prototype.reload = function reload(then) { | ||
893 | "use strict"; | ||
894 | if (!this.started) { | ||
895 | throw new CasperError("Casper not started, can't reload()"); | ||
896 | } | ||
897 | this.evaluate(function() { | ||
898 | window.location.reload(); | ||
899 | }); | ||
900 | if (then && utils.isFunction(then)) { | ||
901 | this.then(this.createStep(then)); | ||
902 | } | ||
903 | return this; | ||
904 | }; | ||
905 | |||
906 | /** | ||
887 | * Repeats a step a given number of times. | 907 | * Repeats a step a given number of times. |
888 | * | 908 | * |
889 | * @param Number times Number of times to repeat step | 909 | * @param Number times Number of times to repeat step | ... | ... |
-
Please register or sign in to post a comment