try-puppeteer
try-puppeteer copied to clipboard
broken example: screenshot-fullpage.js
at https://try-puppeteer.appspot.com, using example screenshot-fullpage.js
this line fails:
const devices = require('puppeteer/DeviceDescriptors');
error:
Error running your code. ReferenceError: require is not defined
Thanks for filing. It's a known issue with that sample. I'll see what I can do :)
Any update on this issue?
No update.
As a workaround it is possible to use:
const DEVICE = {
'name': 'iPhone 6',
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
'viewport': {
'width': 375,
'height': 667,
'deviceScaleFactor': 2,
'isMobile': true,
'hasTouch': true,
'isLandscape': false
}
};
await page.emulate(DEVICE);
where DEVICE may be replaced with any item from devices array.