SAP UIVeri5 跳过检查 Google Chrome d
2021-10-10 本文已影响0人
_扫地僧_
由于众所周知的原因,国内访问 Google 某些网站时会遇到一些问题。而使用 SAP UIVeri5 时,在启动阶段,会自动连接 Google 网站检测 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'
});
});
};
即不真正去检查版本,而总是返回一个硬编码的版本。