Search
K

simulateKey

Simulates a key press.
simulateKey accepts string parameter. The following keys are supported as input in additional to regular keys to simulateKey():
"Enter": Enter Key "DELETE": Delete Key "ControlDown": Control Key Down "ControlUp": Control Key Up "ShiftDown": Shift Key Down "ShiftUp": Shift Key Up "AltDown": Alt Key Down "AltUp": Alt Key Up "ArrowDown": Arrow Down Key "ArrowUp": Arrow Up Key "ArrowLeft": Arrow Left Key "ArrowRight": Arrow Right Key "Home": Home Key "End": End Key "PageUp": Page Up Key "PageDown": Page Down Key "Backspace": Backspace Key "Delete": Delete Key "Tab": Tab Key "Escape": Escape Key
Typical usage
//Generated Script id=0
var delayKey = 1000;
setTimeout(function(){
var element = document.querySelector('input#searchInput');
element.dispatchEvent(new Event('focus'));
element.focus();
simulateKey('a');
}, /*delay*/1*delayKey);
//endcode