The dispatchEvent browser method doesn't work
Hi all,
in a web test (I'm using JavaScript), I want to use the "dispatchEvent" browser method to dispatch a browser-specific event or a custom event created on the browser.
As simple examples (just to try how to use the method), I've tried to dispatch a "pointerdown" and then a "pointerup" after a delay, or I to do a click on a button using this dispatchEvent method.
I've tried this code:
canvas.dispatchEvent("pointerdown");
Delay(600);
canvas.dispatchEvent("pointerup");
and
button.dispatchEvent("click");
But it doesn't work. Nothing appens in the browser, as if the browser doesn't receive the event.
How can I use this method? Can you please explain me with some examples?
Thanks
Simona
Hi Simona,
Can you provide more details why you need this? Can you describe scenario when regular .Click() method provided by TestComplete does not work?
P.S. https://support.smartbear.com/articles/testcomplete/embedding-scripts-into-web-pages/ might appear to be an inspiring reading...