Automate string input to a input

I know this question has been asked a hundred times.
But once again, the solutions no longer work.

I need to simulate key presses to automate a form.

If I do it like this

document.getElementById("input_id").value = "testinput"

the events from the input do not trigger.
And my value is just deleted again.

is there again a possibility to simulate keystrokes so that also all events are triggered?