Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In page.emulate(option), option. hasTouch not worker #1079

Closed
sheweichun opened this issue Oct 18, 2017 · 3 comments
Closed

In page.emulate(option), option. hasTouch not worker #1079

sheweichun opened this issue Oct 18, 2017 · 3 comments

Comments

@sheweichun
Copy link

Steps to reproduce

Tell us about your environment:

  • Puppeteer version:0.12.0
  • Platform / OS version:mac 10.11.6
  • URLs (if applicable): any mobile page

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. prepare the demo like beblow:
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);
  1. interact with the page in the chrome

What is the expected result?
touch operations work

What happens instead?
touch operations don't work

@JoelEinbinder
Copy link
Collaborator

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.

@actionnick
Copy link

actionnick commented Oct 4, 2018

This should work.

const devtoolsProtocolClient = await page.target().createCDPSession();
await devtoolsProtocolClient.send("Emulation.setEmitTouchEventsForMouse", { enabled: true });

@TNT-Likely
Copy link

@actionnick it work fine for me,thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants