I have a page with two frames:
<frameset>
<frame src="left.php" name="left">
<frame src="right.php" name="right">
<span id="aButton"><a href="gosomewhere.php"><span class="buttonContainer"><span class="buttonText">a button</span></span></a></span>
</frameset>
I want to click the link inside the second frame like this:
page.render("screen1.jpg");
page.switchToFrame("right");
var recta = page.evaluate(function() {
return document.querySelector('#aButton a').getBoundingClientRect();
});
page.sendEvent('click', recta.left + recta.width / 2, recta.top + recta.height / 2);
page.render("screen2.jpg");
console.log(page.frameContent);
However, the click does not seem to register as my screen2.jpg
shows no change. frameContent
only shows html from frame "right
", so I know that switchToFrame
is working.
Is there a special way to handle clicking inside frames beyond the switchToFrame
function? I have also tried document.querySelector('#aButton a').click()
but no luck.