lib/navigation.js
function navigateToUrl(page, ph, url, callback) {

    var oldUrl;
    async.waterfall([
        function (callback) {
            page.get('url', function (url) {
                oldUrl = url;
                callback();
            });
        },

        function (callback) {
            page.evaluate(function (url) {
                try {
                    window.location.href = url;
                } catch (exception) {
                    return exception;
                }
            }, function (error) {
                // do this because if there is no error, the error is still something so we can't simply do callback(error);
                if (error) {
                    callback(error);
                    return;
                }

                callback();
            }, url);
        },

        function (callback) {
            checks.pageHasChanged(page, oldUrl, function (error) {
                callback(error);
            });
        }
    ], function (error) {
        callback(error, page, ph);
    });
}
function navigateToUrl(page, ph, url, callback) {

    var oldUrl;
    async.waterfall([
        function (callback) {
            page.get('url', function (url) {
                oldUrl = url;
                callback();
            });
        },

        function (callback) {
            page.evaluate(function (url) {
                try {
                    window.location.href = url;
                } catch (exception) {
                    return exception;
                }
            }, function (error) {
                // do this because if there is no error, the error is still something so we can't simply do callback(error);
                if (error) {
                    callback(error);
                    return;
                }

                callback();
            }, url);
        },

        function (callback) {
            checks.pageHasChanged(page, oldUrl, function (error) {
                callback(error);
            });
        }
    ], function (error) {
        callback(error, page, ph);
    });
}
function navigateToUrl ( page , ph , url , callback ) { var oldUrl ; async . waterfall ( [ function ( callback ) { page . get ( 'url' , function ( url ) { oldUrl = url ; callback ( ) ; } ) ; } , function ( callback ) { page . evaluate ( function ( url ) { try { window . location . href = url ; } catch ( exception ) { return exception ; } } , function ( error ) { // do this because if there is no error, the error is still something so we can't simply do callback(error); if ( error ) { callback ( error ) ; return ; } callback ( ) ; } , url ) ; } , function ( callback ) { checks . pageHasChanged ( page , oldUrl , function ( error ) { callback ( error ) ; } ) ; } ] , function ( error ) { callback ( error , page , ph ) ; } ) ; }
Navigates to another url using the same page
@param page
@param ph
@param {string} url
@param {pageCallback} callback
Navigates to another url using the same page