1element.dispatchEvent(new KeyboardEvent("keydown", {
2 key: "e",
3 keyCode: 69, // example values.
4 code: "KeyE", // put everything you need in this object.
5 which: 69,
6 shiftKey: false, // you don't need to include values
7 ctrlKey: false, // if you aren't going to use them.
8 metaKey: false // these are here for example's sake.
9}));