I have an iframe and, inside the website in the iframe, there is a button that I want to be automatically clicked when the iframe load. This is the HTML code.
<div class="buttonnext action-button-container">
<button type="button" id="nextBtn" class="action-button red0">
<span id="nextBtn-final">
CLICK TO PROCEED
</span>
</button>
</div>
/* You can do it in this way.
1. Get Iframe element
2. Get the content window object and do a normal dom traversal to your button.
3. Trigger the event.
*/
var iframe = document.getElementById("iframe");
var elmnt = iframe.contentWindow.document.getElementsById("nextBtn");
elmnt.click();