docs: function (path, pathname, hash, uuid, result) {
      var deferred = Q.defer();
      // replace base64 metadata
      var base64Data = JSON.parse(result).value.replace(/^data:image\/png;base64,/,'');
      // replace placeholders
      var realpath = this._replacePathPlaceholder(path + pathname);
      // check if we need to add a new directory
      this._recursiveMakeDirSync(realpath.substring(0, realpath.lastIndexOf('/')));
      // write the screenshot
      fs.writeFileSync(realpath, base64Data, 'base64');
      this.events.emit('driver:message', {key: 'screenshot', value: realpath, uuid: hash, hash: hash});
      deferred.resolve();
      return deferred.promise;
    }