spec/fixtures/pages/key-events.html (12 lines of code) (raw):

<html> <body> <script type="text/javascript" charset="utf-8"> document.onkeydown = function (e) { require('electron').ipcRenderer.send('keydown', e.key, e.code, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey) } document.onkeypress = function (e) { require('electron').ipcRenderer.send('keypress', e.key, e.code, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey) } </script> </body> </html>