fixed no error was raised if Casper.viewport() was called before casper having been started
Showing
1 changed file
with
3 additions
and
0 deletions
... | @@ -881,6 +881,9 @@ | ... | @@ -881,6 +881,9 @@ |
881 | * @return Casper | 881 | * @return Casper |
882 | */ | 882 | */ |
883 | viewport: function(width, height) { | 883 | viewport: function(width, height) { |
884 | if (!this.started) { | ||
885 | throw new Error("Casper must be started in order to set viewport at runtime"); | ||
886 | } | ||
884 | if (!isType(width, "number") || !isType(height, "number") || width <= 0 || height <= 0) { | 887 | if (!isType(width, "number") || !isType(height, "number") || width <= 0 || height <= 0) { |
885 | throw new Error("Invalid viewport width/height set: " + width + 'x' + height); | 888 | throw new Error("Invalid viewport width/height set: " + width + 'x' + height); |
886 | } | 889 | } | ... | ... |
-
Please register or sign in to post a comment