lib/actions.js
function fillForm(page, ph, selectorAndValue, callback) {
    page.evaluate(function (selectorAndValue) {
        try {
            var selector = selectorAndValue[0];
            var value = selectorAndValue[1];
            document.querySelector(selector).value = value;
            return null;
        } catch (error) {
            return error;
        }
    }, function (error) {
        // do this because if there is no error, the error is still something so we can't simply do callback(error, page, ph);
        if (error) {
            callback(error, page, ph);
            return;
        }
        callback(null, page, ph);
    }, selectorAndValue);
}
function fillForm(page, ph, selectorAndValue, callback) {
    page.evaluate(function (selectorAndValue) {
        try {
            var selector = selectorAndValue[0];
            var value = selectorAndValue[1];
            document.querySelector(selector).value = value;
            return null;
        } catch (error) {
            return error;
        }
    }, function (error) {
        // do this because if there is no error, the error is still something so we can't simply do callback(error, page, ph);
        if (error) {
            callback(error, page, ph);
            return;
        }
        callback(null, page, ph);
    }, selectorAndValue);
}
function fillForm ( page , ph , selectorAndValue , callback ) { page . evaluate ( function ( selectorAndValue ) { try { var selector = selectorAndValue [ 0 ] ; var value = selectorAndValue [ 1 ] ; document . querySelector ( selector ) . value = value ; return null ; } catch ( error ) { return error ; } } , function ( error ) { // do this because if there is no error, the error is still something so we can't simply do callback(error, page, ph); if ( error ) { callback ( error , page , ph ) ; return ; } callback ( null , page , ph ) ; } , selectorAndValue ) ; }
Fills a form on the page
@param page
@param ph
@param {Array} selectorAndValue index 0 - {string} selector
index 1 - {string} value
@param {pageCallback} callback
Fills a form on the page