Cleanup usages of Page.saveScreenshot of 3b0bc080

The `Page.saveScreenshot` method was removed in favor of a `path`
option in the `Page.screenshot` method.
This commit is contained in:
Andrey Lushnikov 2017-06-19 16:26:23 -07:00 committed by Pavel Feldman
parent e73d22a564
commit fce6b71d8e
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ browser.newPage().then(async page => {
await page.setViewportSize({width: 400, height: 400}); await page.setViewportSize({width: 400, height: 400});
await page.setContent('<html><body><canvas id="surface"></canvas></body></html>'); await page.setContent('<html><body><canvas id="surface"></canvas></body></html>');
await page.evaluate(drawColorWheel); await page.evaluate(drawColorWheel);
await page.saveScreenshot('colorwheel.png'); await page.screenshot({path: 'colorwheel.png'});
browser.close(); browser.close();
}); });

View File

@ -297,7 +297,7 @@ class WebPage {
} else { } else {
var options = {}; var options = {};
if (this.clipRect && (this.clipRect.left || this.clipRect.top || this.clipRect.width || this.clipRect.height)) { if (this.clipRect && (this.clipRect.left || this.clipRect.top || this.clipRect.width || this.clipRect.height)) {
options.clipRect = { options.clip = {
x: this.clipRect.left, x: this.clipRect.left,
y: this.clipRect.top, y: this.clipRect.top,
width: this.clipRect.width, width: this.clipRect.width,
@ -305,7 +305,7 @@ class WebPage {
}; };
} }
options.path = fileName; options.path = fileName;
await(this._page.saveScreenshot(fileName, clipRect)); await(this._page.screenshot(options));
} }
} }