From fce6b71d8e4487612a766caadb703a9213e77251 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 19 Jun 2017 16:26:23 -0700 Subject: [PATCH] Cleanup usages of Page.saveScreenshot of 3b0bc080 The `Page.saveScreenshot` method was removed in favor of a `path` option in the `Page.screenshot` method. --- examples/colorwheel.js | 2 +- phantom_shim/WebPage.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/colorwheel.js b/examples/colorwheel.js index c9bade3a..477f3ae4 100644 --- a/examples/colorwheel.js +++ b/examples/colorwheel.js @@ -21,7 +21,7 @@ browser.newPage().then(async page => { await page.setViewportSize({width: 400, height: 400}); await page.setContent(''); await page.evaluate(drawColorWheel); - await page.saveScreenshot('colorwheel.png'); + await page.screenshot({path: 'colorwheel.png'}); browser.close(); }); diff --git a/phantom_shim/WebPage.js b/phantom_shim/WebPage.js index b4c081d4..5f98da0e 100644 --- a/phantom_shim/WebPage.js +++ b/phantom_shim/WebPage.js @@ -297,7 +297,7 @@ class WebPage { } else { var options = {}; if (this.clipRect && (this.clipRect.left || this.clipRect.top || this.clipRect.width || this.clipRect.height)) { - options.clipRect = { + options.clip = { x: this.clipRect.left, y: this.clipRect.top, width: this.clipRect.width, @@ -305,7 +305,7 @@ class WebPage { }; } options.path = fileName; - await(this._page.saveScreenshot(fileName, clipRect)); + await(this._page.screenshot(options)); } }