【发布时间】:2018-05-18 16:38:46
【问题描述】:
我正在尝试从 APEX 应用程序自动下载 CSV 文件。
var casper = require('casper').create({verbose: true, logLevel: "debug", viewportSize: { width: 1600, height: 400 } });
var url = "https://example.com"
casper.start(url);
casper.then(function () {
this.fill('#wwvFlowForm', {'P101_USERNAME': 'user', 'P101_PASSWORD': 'password'}, false);
});
casper.then(function () {
this.click('#P101_LOGIN');
}).wait(5000).then(function () {
this.echo('downloading file');
this.download('https://example/apex/f?p=1002:173:10072525691961:CSV','report.csv')
});
casper.run();
我可以登录,但是当我尝试下载文件时,我得到了登录页面 html。 我尝试过使用 getBase64 方法,结果相同。 casper.download 是否使用不同的会话? 下载前后的截图显示我已经登录了。
【问题讨论】: