Answer the question
In order to leave comments, you need to log in
How to simulate mouse clicks on a React component?
Greetings. I am writing a small chrome extension for myself.
The question arose how to simulate a mouse click on a React component.
Tried through dispatchEvent and just click (through JQuery and native JS), the event is processed (caught through Breakpoint) but the application does not react to it.
Experiments were carried out in the browser console.
PS
With buttons, everything works well, a snag with drop-down selects on the form.
Answer the question
In order to leave comments, you need to log in
How to simulate mouse clicks on a React component?
select.value = someValue;
select.dispatchEvent(new Event('change', { bubbles: true }));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question