Phantomjs equivalent of browser's “Save Page As… Webpage, complete”

血红的双手。 提交于 2019-12-04 17:21:47

Alternatively the PhantomJS, you can use the CasperJS to achieve the required result. CasperJS is a framework based on the PhantomJS, however, with a variety of modules and classes that support and complement the PhantomJS.

An example of a script that you can use is:

casper.test.begin('test script', 0, function(test) {
    casper.start(url);

    casper.then(function myFunction(){
        //...
    });

    casper.run(function () {
        //...
        test.done();
    });
});

With this script, within a "step", you can perform your downloads, be it a single image of a document, the page, a print or whatever. Take a study on the download methods, getPageContent and capture / captureSelector in this link.

I hope these pointers can help you to go further!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!