try-puppeteer icon indicating copy to clipboard operation
try-puppeteer copied to clipboard

broken example: screenshot-fullpage.js

Open pascalpp opened this issue 8 years ago • 4 comments

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

pascalpp avatar Sep 25 '17 21:09 pascalpp

Thanks for filing. It's a known issue with that sample. I'll see what I can do :)

ebidel avatar Sep 25 '17 21:09 ebidel

Any update on this issue?

sushant-j avatar Feb 19 '18 10:02 sushant-j

No update.

ebidel avatar Feb 19 '18 22:02 ebidel

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.

lusarz avatar Oct 01 '18 14:10 lusarz