code: function pageHasChanged(page, oldUrl, callback) {
      var elapsed = 0;
  
      var newUrl;
      var urlHasChanged = false;
      var documentReady = false;
      var waitTimeOver = false;
  
      async.until(
          function () {
              waitTimeOver = elapsed > constants.WAIT_TIMEOUT;
              return waitTimeOver || documentReady;
          },
  
          function (callback) {
              // polls the page at an interval
              setTimeout(function () {
                  elapsed += constants.POLL_INTERVAL;
  
                  async.waterfall([
                      function (callback) {
                          // checks the url
                          page.get('url', function (url) {
                              newUrl = url;
                              urlHasChanged = newUrl !== oldUrl;
  
                              callback();
                          })
                      },
                      function (callback) {
                          if (!urlHasChanged) {
                              callback();
                              return;
                          }
  
                          // checks the document.readyState
                          page.evaluate(function () {
                              return (document.readyState === 'interactive') || (document.readyState === 'complete');
                          }, function (domReady) {
                              documentReady = domReady;
                              callback();
                          });
                      }
                  ], function (error) {
                      // no error is triggered
                      callback();
                  });
              }, constants.POLL_INTERVAL);
          },
  
          function (error) {
              if (waitTimeOver) {
                  // todo Go back to previous url?
                  callback('Timeout while navigating to ' + url);
                  return;
              }
  
              callback();
          }
      );
  }
docs: Helper function to check if a page has changed
  Use case: Navigating to another url
  @param page
  @param {string} oldUrl
  @param {nodeCallback} callback