I am trying to emulate devices on the puppeteer, for that I written below code block in nodejs and mocha test function
it('Should launch a mobile window', async function () {
const mobile = puppeteer.devices['iPhone X']
await page.emulate(mobile)
await page.goto('https://www.imperva.com')
await page.waitFor(5000)
})
But after running the test, I am getting below error
1) Device emulation
Should launch a mobile window:
TypeError: Cannot read property 'viewport' of undefined
at Page.emulate (node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:843:38)
at Context.<anonymous> (tests\device.test.js:28:20)
at processImmediate (internal/timers.js:456:21)
How to fix this issue?
Aucun commentaire:
Enregistrer un commentaire