lib/jquery.go.js
function(url, callback) {
    var self = this;
    getPage(function(page) {

      // Set the page size if it hasn't already been set.
      if (!self.viewportSizeSet) {
        self.viewportSizeSet = true;
        page.set('viewportSize', {
          width: self.config.width,
          height: self.config.height
        }, function (result) {
          self.debug("Viewport set to: " + result.width + "x" + result.height);
        });
      }

      // Set a custom user agent if it hasn't already been set.
      if (self.config.userAgent && !self.userAgentSet) {
        self.userAgentSet = true;
        page.set('settings.userAgent', self.config.userAgent, function (result) {
          self.debug("Useragent set to: " + result);
        });
      }

      // Open the page.
      self.debug('Navigating to ' + self.config.site + url);
      page.open(self.config.site + url, function(status) {
        if (status == 'fail') {
          self.close();
          throw new Error(status);
        }
        if (self.config.addJQuery) {
          var loadJS = function() {
            if (loading) {
              setTimeout(loadJS, 100);
            }
            else {
              page.includeJs(self.config.jQuery, callback);
            }
          }
          loadJS();
        }
        else {
          self.waitForPage(callback);
        }
      });
    });
  }
function(url, callback) {
    var self = this;
    getPage(function(page) {

      // Set the page size if it hasn't already been set.
      if (!self.viewportSizeSet) {
        self.viewportSizeSet = true;
        page.set('viewportSize', {
          width: self.config.width,
          height: self.config.height
        }, function (result) {
          self.debug("Viewport set to: " + result.width + "x" + result.height);
        });
      }

      // Set a custom user agent if it hasn't already been set.
      if (self.config.userAgent && !self.userAgentSet) {
        self.userAgentSet = true;
        page.set('settings.userAgent', self.config.userAgent, function (result) {
          self.debug("Useragent set to: " + result);
        });
      }

      // Open the page.
      self.debug('Navigating to ' + self.config.site + url);
      page.open(self.config.site + url, function(status) {
        if (status == 'fail') {
          self.close();
          throw new Error(status);
        }
        if (self.config.addJQuery) {
          var loadJS = function() {
            if (loading) {
              setTimeout(loadJS, 100);
            }
            else {
              page.includeJs(self.config.jQuery, callback);
            }
          }
          loadJS();
        }
        else {
          self.waitForPage(callback);
        }
      });
    });
  }
function ( url , callback ) { var self = this ; getPage ( function ( page ) { // Set the page size if it hasn't already been set. if ( ! self . viewportSizeSet ) { self . viewportSizeSet = true ; page . set ( 'viewportSize' , { width : self . config . width , height : self . config . height } , function ( result ) { self . debug ( "Viewport set to: " + result . width + "x" + result . height ) ; } ) ; } // Set a custom user agent if it hasn't already been set. if ( self . config . userAgent && ! self . userAgentSet ) { self . userAgentSet = true ; page . set ( 'settings.userAgent' , self . config . userAgent , function ( result ) { self . debug ( "Useragent set to: " + result ) ; } ) ; } // Open the page. self . debug ( 'Navigating to ' + self . config . site + url ) ; page . open ( self . config . site + url , function ( status ) { if ( status == 'fail' ) { self . close ( ) ; throw new Error ( status ) ; } if ( self . config . addJQuery ) { var loadJS = function ( ) { if ( loading ) { setTimeout ( loadJS , 100 ) ; } else { page . includeJs ( self . config . jQuery , callback ) ; } } loadJS ( ) ; } else { self . waitForPage ( callback ) ; } } ) ; } ) ; }
Used to visit a page.

@param {string} url
The url you wish to visit.
@param {function} callback
Called when the page is done visiting.
Used to visit a page .