casper.download 函数
casper.thenOpen(url, function(){
// 假设 form 的 action 为 POST,需要提交以下几个 input 的值
var data = {
username: 'hanmeimei',
filename: 'lilei.pdf',
};
var action_url = '/files/download';
var save_to_path = '/tmp/lilei.pdf';
var action_method = 'POST';
casper.download(action_url, save_to_path, action_method, data);
});
网友评论