I want to automate a React app by filling forms using a js snippet, but I cannot make it to call the onChange handler. I emit the change event with the following code:
const event = new Event("change",
{
bubbles: true,
cancelable: true,
view: window,
target: { value: "new value"}
});
const element = document.querySelector("#inp");
element.value = "new value";
const cancelled = element.dispatchEvent(event);
but the React refuses to change the value of the text input.
The complete example is here https://jsfiddle.net/gLysoa8v/3/