function pressEnter(element){
if(!(element instanceof EventTarget))
element = document.querySelector(element) || document.body || document;
var options = {
bubbles: true,
cancelable: true,
charCode: 0,
code: "Enter",
key: "Enter",
keyCode: 13,
view: window,
which: 13
};
['keydown', 'keypress', 'keyup'].forEach(
type => element.dispatchEvent(
new KeyboardEvent(type, options)
)
);
}
setInterval(
() => pressEnter('body'), //нажимаем enter на body
5 * 1000 //раз в пять секунд
);