Emulate Touch Scroll



I am using webContents.enableDeviceEmulation to display my content the same way on a mobile and on desktop. Works great.

Unfortunately, I can’t find a way to simulate touch events in this DeviceEmulation view.

What I want to achieve is : simulate touchStart / touchMove / touchEnd events, and be able to scroll inside the view, just like when you use Chrome Device Emulation (when your cursor becomes a black circle and works like your finger)

Any idea ?

Thanks !

Touch Events And Scroll

Hi there

I have the exact same issue as you?
Did you manage to solve it?


This problem is not about electron or atom itself, but about the chrome dev tools. By using the enableDeviceEmulation you can not get what you want, the only one is to use Debugger. the code is like this.

window.getWebContents().debuggersendCommand('Emulation.setTouchEmulationEnabled', {
  enabled: true,
  configuration: 'mobile',
window.getWebContents().debuggersendCommand('Emulation.Emulation.setDeviceMetricsOverride', {
  width: 480,
  height: 600,
  deviceScaleFactor: 1,
  mobile: true,
  fitWindow: true,

Webview can do the same thing by getWebcontents().


Finally, I got it to work. Dev env:
node 7.4.0
Chromium 54.0.2840.101
Electron 1.5.1
Full answer on stack