0

I want to automatically click a button on a web page. I have the following code to do so:

let script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);

$("button.myButton").click();

When i run it, it doesn't click the button. Help.

0 Answers0