I'm a newbie of CasperJS. I'm trying to download a file after clicking on a button.
I've successfully intercepted the url using
casper.on('resource.received', function(resource) {
if (resource.stage !== "end") {
return;
}
if (resource.url.indexOf('Xml') > -1) {
this.echo(JSON.stringify(resource));
}
});
But I cannot download the file at all.
Checking with Charles I found out that two ajax calls are performed: the first is the one I intercept, and returns a xml with a CDATA.
In this CDATA there is JS code with the url used from the page to start the download request.
It's possible to intercept or emulate this behavior in CasperJS?
Best, Marco