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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: consider to invoke Emulation.setEmitTouchEventsForMouse for isMobile:true devices #30582

Closed
PupilTong opened this issue Apr 28, 2024 · 5 comments

Comments

@PupilTong
Copy link

PupilTong commented Apr 28, 2024

馃殌 Feature Request

https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setEmitTouchEventsForMouse

it('should work on scroll container', async ({ page, server }) => {
  const client = await page.context().newCDPSession(page);
  await page.setContent(`<div id="container" style="width: 500px; height: 500px; overflow-y:scroll;"><div style="width:100%; height:200%;"></div></div>`);
  await client.send('Emulation.setEmitTouchEventsForMouse',{"enabled":true,"configuration":"mobile"});
  await client.send('Input.emulateTouchFromMouseEvent',{type: 'mousePressed',button: 'left',x: 100,y:200,});
  await client.send('Input.emulateTouchFromMouseEvent',{type: 'mouseMoved',button: 'left',x: 100,y:100,});
  await client.send('Input.emulateTouchFromMouseEvent',{type: 'mouseReleased',button: 'left',x: 100,y:100,});
  expect(await page.$eval('#container', e => e.scrollTop)).toBeGreaterThan(0);
});

Example

No response

Motivation

For mobile gesture emulation, it could help developer to mock touchscreen gesture

@dgozman
Copy link
Contributor

dgozman commented Apr 29, 2024

@PupilTong Could you please explain your usecase in more details? We would like to understand the problem to be solved, before jumping into possible solutions.

@PupilTong
Copy link
Author

@PupilTong Could you please explain your usecase in more details? We would like to understand the problem to be solved, before jumping into possible solutions.

#2903

It may help to emulate more touchscreen gesture.

@PupilTong
Copy link
Author

Expose the dispatchTouch related CDP methods may help too I guess

@dgozman
Copy link
Contributor

dgozman commented May 1, 2024

@PupilTong So, are you after testing touch gestures? Then we should close this in favor of #2903. If you have a different scenario in mind, please explain in more details.

@PupilTong
Copy link
Author

@PupilTong So, are you after testing touch gestures? Then we should close this in favor of #2903. If you have a different scenario in mind, please explain in more details.

Closed.

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

2 participants