lib/commands/window.js
function (name, hash) {
    this.actionQueue.push(this.webdriverClient.windowHandles.bind(this.webdriverClient));
    this.actionQueue.push(function (result) {
      var deferred = Q.defer();
      if (name === null) {
        deferred.resolve(JSON.parse(result).value[0]);
      }
      deferred.resolve(name);
      return deferred.promise;
    });
    this.actionQueue.push(this.webdriverClient.changeWindow.bind(this.webdriverClient));
    this.actionQueue.push(this._windowCb.bind(this, name, hash));
    return this;
  }
function (name, hash) {
    this.actionQueue.push(this.webdriverClient.windowHandles.bind(this.webdriverClient));
    this.actionQueue.push(function (result) {
      var deferred = Q.defer();
      if (name === null) {
        deferred.resolve(JSON.parse(result).value[0]);
      }
      deferred.resolve(name);
      return deferred.promise;
    });
    this.actionQueue.push(this.webdriverClient.changeWindow.bind(this.webdriverClient));
    this.actionQueue.push(this._windowCb.bind(this, name, hash));
    return this;
  }
function ( name , hash ) { this . actionQueue . push ( this . webdriverClient . windowHandles . bind ( this . webdriverClient ) ) ; this . actionQueue . push ( function ( result ) { var deferred = Q . defer ( ) ; if ( name === null ) { deferred . resolve ( JSON . parse ( result ) . value [ 0 ] ) ; } deferred . resolve ( name ) ; return deferred . promise ; } ) ; this . actionQueue . push ( this . webdriverClient . changeWindow . bind ( this . webdriverClient ) ) ; this . actionQueue . push ( this . _windowCb . bind ( this , name , hash ) ) ; return this ; }
Switches to another window context

@method toFrame
@param {string} name Name of the window to switch to
@param {string} hash Unique hash of that fn call
@chainable
Switches to another window context