pengiriman keydown event javascript

element.dispatchEvent(new KeyboardEvent('keydown', {'key':'Shift'} ));
element.dispatchEvent(new KeyboardEvent( 'keyup' , {'key':'Shift'} )); //To mimic keypress 

//More complete example
//https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent
element.dispatchEvent(new KeyboardEvent("keydown", {
    key: "e",
    keyCode: 69, 
    code: "KeyE", 
    which: 69,
    shiftKey: false, 
    ctrlKey: false,  
    metaKey: false   
}));
Gubo97000