如何使用casperjs下载文件?

时间:2019-02-23 18:26:43

标签: post download casperjs

我正在尝试使用casperjs中的序列化后下载和后下载方式在网站中另存为文件,但没有任何反应

这是我的代码

casper.then(function(){
    console.log("Login using username and password");
    this.evaluate(function(){




                 document.querySelector("input#ctl00_bodyGrid_gridDetalle_ctl02_gvDetails_ctl01_chkAll").click();
                document.querySelector("input#ctl00_bodyGrid_txtEmail.columnaCampoEmail").value = "emailx@hotmail.com";
var params =$('form#aspnetForm').serialize();

    casper.download(document.forms["aspnetForm"].action, "downloaded_file.zip", "POST", params);

    });

 });

casper.then(function(){

    this.wait(40000);//Wait a bit so page loads (there are a lot of ajax calls and that is why we are waiting 6 seconds)
    this.capture('googlex5.png');
});

我的代码有什么问题

请帮助我

0 个答案:

没有答案