Commit a2420455 a2420455f2b06414b604654f11ee4c33c52d70aa by Nicolas Perriault

added away to change viewport

1 parent 74e81194
Showing 1 changed file with 17 additions and 0 deletions
......@@ -577,6 +577,12 @@
}
}
this.page.settings = mergeObjects(this.page.settings, this.options.pageSettings);
if (typeof this.options.clipRect === "object") {
this.page.clipRect = this.options.clipRect;
}
if (typeof this.options.viewportSize === "object") {
this.page.viewportSize = this.options.viewportSize;
}
this.started = true;
if (typeof this.options.timeout === "number" && this.options.timeout > 0) {
self.log("execution timeout set to " + this.options.timeout + 'ms', "info");
......@@ -661,6 +667,17 @@
},
/**
* Changes the current viewport size.
*
* @param Object viewportSize An objet with two props: width and height
* @return Casper
*/
viewport: function(viewportSize) {
this.page.viewportSize = viewportSize;
return this;
},
/**
* Adds a new step that will wait for a given amount of time (expressed
* in milliseconds) before processing an optional next one.
*
......