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:
parent
e73d22a564
commit
fce6b71d8e
@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user