我已尝试过在网络上与此有关的所有示例,但似乎没有任何效果。我需要单击下载xls文件的导出按钮。这是我的casper代码。请帮忙。谢谢!
casper.thenClick('#dnn_ctr623_ServiceJobsQueue_lnkExport', function() {
casper.capture('data2.png');
});
casper.on('resource.received', function (resource) {
"use strict";
if (resource.url.indexOf(" ") !== -1) {
var url, file;
url = resource.url;
file = 'monitest.xls';
try {
this.echo("Attempting to download file " + file);
casper.download(resource.url, file, "GET");
} catch (e) {
this.echo(e);
}
}
});
这是__doPostBack函数:
<a id="dnn_ctr623_ServiceJobsQueue_lnkExport" class="menulinksStyle" href="javascript:__doPostBack('dnn$ctr623$ServiceJobsQueue$lnkExport','')" style="color:Green">Export</a>