Returning links inside iframe using a function in CasperJS
问题 I am trying to get the links from inside an iframe and return them as a function result, my simplified code looks something like this: var casper = require("casper").create({ verbose: true, logLevel: "debug", webSecurityEnabled: false }); var url = casper.cli.get(0); casper.on('remote.message', function(msg) { this.echo(msg); }) casper.start(url, function () { thelinks = getLinksFromIframes( casper ); console.log("doesn't work:" + thelinks); }); function getLinksFromIframes( context ) { var