I am trying to click over an iframe, where there is a button, by clicking dynamically on certain coordinates. I created a button which dinamically clicks on the coordinates where that button is located, but it does not work.
In this JSFiddle sample I have the button clicks on the coordinate of x=30px and y=30px of the document where the bing logo is located, but when I click on the button, the Bing logo in iframe does not trigger.
<div class="button">Click Here</div>
<iframe src="https://www.bing.com/images" width="200" height="70"></iframe>
<script>
function clicktransfer(x, y) {
jQuery(document.elementFromPoint(x, y)).click();
}
$( ".gray" ).click(function() {
clicktransfer(30, 30);
});
</script>
Any thoughts?