2024-01-08, 11:50:39
Hi,
Not sure yet how-to do this.
I can get the button object in javascript like so:
but that doesn't mean I can invoke a click on it as the button object does not have the method.
Next up I tried:
which then gave me "Uncaught TypeError: cb.dispatchEvent is not a function"
So for the moment I don't know.
--
Wil
Not sure yet how-to do this.
I can get the button object in javascript like so:
Code:
var downloadButton;
downloadButton = document.getElementsByClassName("mega-button positive js-default-download js-standard-download");
but that doesn't mean I can invoke a click on it as the button object does not have the method.
Next up I tried:
Code:
function simulateClick() {
const event = new MouseEvent("click", {
view: window,
bubbles: true,
cancelable: true,
});
const cb = document.getElementsByClassName("mega-button positive js-default-download js-standard-download");
const cancelled = !cb.dispatchEvent(event);
if (cancelled) {
// A handler called preventDefault.
alert("cancelled");
} else {
// None of the handlers called preventDefault.
alert("not cancelled");
}
}
So for the moment I don't know.
--
Wil