mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
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:
parent
3a7741a172
commit
25465525c1
@ -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();
|
||||||
|
|
||||||
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user