Fix full page screenshot example (#237)

This patch aligns the example with our style in `examples/` folder, and also starts to use page.goto instead of page.navigate
This commit is contained in:
Andrey Lushnikov 2017-08-10 21:44:27 -07:00 committed by GitHub
parent 3a7741a172
commit 25465525c1

View File

@ -18,9 +18,12 @@ const {Browser} = require('puppeteer');
const devices = require('puppeteer/DeviceDescriptors'); const devices = require('puppeteer/DeviceDescriptors');
const browser = new Browser(); const browser = new Browser();
browser.newPage().then(async page => { (async() => {
await page.emulate(devices['iPhone 6']);
await page.navigate('https://www.nytimes.com/'); let page = await browser.newPage();
await page.screenshot({path: 'fp_page.png', fullPage: true}); await page.emulate(devices['iPhone 6']);
browser.close(); await page.goto('https://www.nytimes.com/');
}); await page.screenshot({path: 'full.png', fullPage: true});
browser.close();
})();