Reputation: 379
I have a site with 3 frames. I want to visit main page, and then switch to child frame and open another page in this frame. Is this possible? There is not really much about this in the documentation.
Upvotes: 2
Views: 50
Reputation: 61892
You can switch to the parent/main frame of the frame that you want to change the URL for and simply change the src
attribute:
page.evaluate(function(pos, newSrc){
document.querySelectorAll("iframe")[pos].src = newSrc;
}, 0, "http://example.com");
// wait a little
setTimeout(function(){
page.switchToChildFrame(0);
// do something
}, 2000);
Upvotes: 2