lib/jquery.go.js
function(element, callback, nowait) {
    var self = this;
    if (!nowait) {
      this.waitForPage(function() {
        self.waitForElement(element, callback, true);
      });
    }
    else {
      var loadWait = function() {
        setTimeout(function() {
          self.waitForElement(element, callback, true);
        }, 100);
      };
      if (nowait) {
        getPage(function(page) {
          page.evaluate(function(element) {
            var element = jQuery(element);
            return ((element.length > 0) && element.is(':visible'));
          }, function(found) {
            if (found) {
              self.debug('Element ' + element + ' found');
              callback.call(self);
            }
            else {
              loadWait();
            }
          }, element);
        });
      }
      else {
        loadWait();
      }
    }
  }
function(element, callback, nowait) {
    var self = this;
    if (!nowait) {
      this.waitForPage(function() {
        self.waitForElement(element, callback, true);
      });
    }
    else {
      var loadWait = function() {
        setTimeout(function() {
          self.waitForElement(element, callback, true);
        }, 100);
      };
      if (nowait) {
        getPage(function(page) {
          page.evaluate(function(element) {
            var element = jQuery(element);
            return ((element.length > 0) && element.is(':visible'));
          }, function(found) {
            if (found) {
              self.debug('Element ' + element + ' found');
              callback.call(self);
            }
            else {
              loadWait();
            }
          }, element);
        });
      }
      else {
        loadWait();
      }
    }
  }
function ( element , callback , nowait ) { var self = this ; if ( ! nowait ) { this . waitForPage ( function ( ) { self . waitForElement ( element , callback , true ) ; } ) ; } else { var loadWait = function ( ) { setTimeout ( function ( ) { self . waitForElement ( element , callback , true ) ; } , 100 ) ; } ; if ( nowait ) { getPage ( function ( page ) { page . evaluate ( function ( element ) { var element = jQuery ( element ) ; return ( ( element . length > 0 ) && element . is ( ':visible' ) ) ; } , function ( found ) { if ( found ) { self . debug ( 'Element ' + element + ' found' ) ; callback . call ( self ) ; } else { loadWait ( ) ; } } , element ) ; } ) ; } else { loadWait ( ) ; } } }
Waits for an element to be present.
Waits for an element to be present .