I have a webpage with an iframe. I\'d like to access the contents of the iframe using CasperJS. In particular, I need to click buttons and fill a form. How can I do that?
Suppose we have different frames(frame1 and frame2) and we have to access different elements(like click or check if div tag exits or not) of those frames.
casper.withFrame('frame1', function() {
var file = '//*[@id="profile_file"]';
casper.thenClick(x(file));
});
casper.withFrame('frame2', function() {
casper.then(function () {
casper.waitForSelector('#pageDIV',
function pass() {
console.log("pass");
},
function fail(){
console.log("fail");
}
);
});
});