I'm writing some automation script to click a button (which directs the browser to another page), but having problem getting the script to work. Note that there is no unique id to get element for.
The html:
<form action="https://example.html/" method="POST">
<input class="button-default__2020 button-yellow__2020 btn-single__2020" type="submit" value="Click Button">
</form>
My javascript code:
document.body.innerHTML += '<form id="dummy" action="https://example.html/" method="post"><input type="submit" name="type" value="Click Button"></form>';
document.getElementById("dummy").submit();
What is missing here? Any help appreciated!