lib/getData.js
function downloadFromClick(page, ph, selector, callback) {
    const HREF_KEY = 'href';
    async.waterfall([
        function (callback) {
            getSelectorAttribute(page, ph, [selector, HREF_KEY], callback);
        },
        function (page, ph, relativeHref, callback) {
            getCurrentUrl(page, ph, function (error, page, ph, currentUrl) {
                if (error) {
                    callback(error, page, ph);
                    return;
                }
                callback(null, page, ph, currentUrl + relativeHref);
            });
        },
        function (page, ph, url, callback) {
            downloadFromUrl(page, ph, url, callback);
        }
    ], callback);
}
function downloadFromClick(page, ph, selector, callback) {
    const HREF_KEY = 'href';
    async.waterfall([
        function (callback) {
            getSelectorAttribute(page, ph, [selector, HREF_KEY], callback);
        },
        function (page, ph, relativeHref, callback) {
            getCurrentUrl(page, ph, function (error, page, ph, currentUrl) {
                if (error) {
                    callback(error, page, ph);
                    return;
                }
                callback(null, page, ph, currentUrl + relativeHref);
            });
        },
        function (page, ph, url, callback) {
            downloadFromUrl(page, ph, url, callback);
        }
    ], callback);
}
function downloadFromClick ( page , ph , selector , callback ) { const HREF_KEY = 'href' ; async . waterfall ( [ function ( callback ) { getSelectorAttribute ( page , ph , [ selector , HREF_KEY ] , callback ) ; } , function ( page , ph , relativeHref , callback ) { getCurrentUrl ( page , ph , function ( error , page , ph , currentUrl ) { if ( error ) { callback ( error , page , ph ) ; return ; } callback ( null , page , ph , currentUrl + relativeHref ) ; } ) ; } , function ( page , ph , url , callback ) { downloadFromUrl ( page , ph , url , callback ) ; } ] , callback ) ; }
Clicks an element on the page and downloads the file behind the element
@param page
@param ph
@param {string} selector
@param {pageResultCallback} callback
Clicks an element on the page and downloads the file behind the element