ok, to coś

window.dispatchEvent(new KeyboardEvent('keypress', {
  'key': 'a'
}));
Friendly Hawk