How do I access an iframe from CasperJS?

Spent forever looking for this, and of course I found the answer minutes after posting the question.

I can use the new frame switching commands added to phantomjs in this commit. Specifically, the and functions. It appears undocumented, and it also seems that the methods have been changed for upcoming releases, but it does work:

var casper = require('casper').create({
    verbose: true,
    logLevel: "debug"

casper.start("", function() {'a#main-a');'a#main-b');;'a#iframe-c');;
}); {

Leave a Comment