天天看點

SAP UIVeri5 跳過檢查 Google Chrome driver 版本檢查的方法

Error: Error while getting the latest version number for chromedriver.exe, error: Error: connect ECONNREFUSED 74.125.68.128:443

at _buildErrorObject (C:\app\node-v12.18.3-win-x64\node_modules@ui5\uiveri5\src\connection\latestDriverVersionResolver.js:90:10)

打開檔案 latestDriverVersionResolver.js,找到檢測版本的代碼:

LatestDriverVersionResolver.prototype._getLatestMajorVersion = function (binary) {
  var that = this;

  return q.Promise(function (resolveFn, rejectFn) {
    if (!binary.useDirectUrl && binary.latestMajorVersionFileUrl) {
      that.logger.info('Check for latest major version of: ' + binary.filename);
      request({
        url: binary.latestMajorVersionFileUrl
      }, function (error, res, body) {
        if (_hasError(error, res)) {
          rejectFn(_buildErrorObject(error, res, binary.filename, 'the latest major version number'));
        } else {
          var latestMajorVersion = _parseVersionNumber(body, binary.version);
          that.logger.info('Found latest major version of ' + binary.filename + ': ' + latestMajorVersion);
          resolveFn({
            latestMajorVersion: latestMajorVersion
          });
        }
      });
    } else {
      resolveFn({});
    }
  });
};
      

修改成:

LatestDriverVersionResolver.prototype._getLatestDriverVersion = function (binary) {
  var that = this;

  return q.Promise(function (resolveFn, rejectFn) {
    resolveFn({
            latestVersion: '92.0.4515.107'
          });
  });
};
      

即不真正去檢查版本,而總是傳回一個寫死的版本。

繼續閱讀