Tell us about your environment:
What steps will reproduce the problem?
_Please include code that reproduces the issue._
const puppeteer = require('puppeteer');
const devices = require('puppeteer/DeviceDescriptors');
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.emulate(devices['iPad landscape']);
await page.goto(REDIRECT_URL);
What is the expected result?
touch operations work
What happens instead?
touch operations don't work
Emulating a touch device with Puppeteer sets up the page so that something like modernizr will detect touch support. It doesn't convert mouse clicks into touch events. You can use page.touchscreen
to send automated taps into the page.
This should work.
const devtoolsProtocolClient = await page.target().createCDPSession();
await devtoolsProtocolClient.send("Emulation.setEmitTouchEventsForMouse", { enabled: true });
@actionnick it work fine for me,thanks
Most helpful comment
This should work.