From 7bf368403952490a48bc739486c22b39bf02009e Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 12 May 2017 11:12:32 -0700 Subject: [PATCH] Update examples/screenshot.js to use Page.saveScreenshot --- examples/screenshot.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/screenshot.js b/examples/screenshot.js index 51a2f69f02c..5b6e378b4b0 100644 --- a/examples/screenshot.js +++ b/examples/screenshot.js @@ -14,14 +14,11 @@ * limitations under the License. */ -var Browser = require('./lib/Browser'); -var Page = require('./lib/Page'); -var fs = require('fs'); +var Browser = require('../lib/Browser'); var browser = new Browser(); browser.newPage().then(async page => { await page.navigate('http://example.com'); - var screenshotBuffer = await page.screenshot(Page.ScreenshotTypes.PNG); - fs.writeFileSync('example.png', screenshotBuffer); + await page.saveScreenshot('example.png'); browser.close(); });