使用 https 协议连接到本地服务器时 Protractor 握手失败
Protractor handshake failed when connecting to local server with https protocol
我正在尝试编写量角器测试,但我的应用程序连接到 WLS 服务器,该服务器使用 TEST 证书对进一步通信进行身份验证。
由于我的公司原因,我没有更新 webdriver 的选项 policy.So 我已经下载 chrome 驱动程序并正在使用它。
量角器:5.4.2
Chrome: 74.0.3729.169
Chrome 驱动程序:chromedriver_74.0.3729.6_win32
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const {SpecReporter} = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 30000,
chromeDriver: '../lib/chromedriver_74.0.3729.6_win32.exe',
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome',
'acceptInsecureCerts': true,
'acceptSslCerts': true,
chromeOptions: {
useAutomationExtension: false,
args: ['--headless']
}
},
framework: 'jasmine',
directConnect: true,
troubleshoot: true,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
defaultTimeoutInterval: 2500000,
print: function () {
}
},
onPrepare: function () {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
}
};
但我收到如下错误:
[0712/104633.475:ERROR:ssl_client_socket_impl.cc(946)] handshake
failed; returned -1, SSL error code 1, net_error -117
[0712/104633.548:INFO:CONSOLE(27396)] "Http failure response for
https://localhost:25000/app/api/disciplines: 0 Unknown Error", source:
http://localhost:8082/app/main.js (27396)
尝试将 --allow-insecure-localhost
and/or --ignore-certificate-errors
添加到 args
数组。
chromeOptions: {
args: [
'--headless',
'--ignore-certificate-errors',
'--allow-insecure-localhost'
]
}
我可以使用以下方法解决它:
通过编辑注册表,我能够停止弹出窗口并执行 auto-select 并且可以 运行 我的测试成功。
我正在尝试编写量角器测试,但我的应用程序连接到 WLS 服务器,该服务器使用 TEST 证书对进一步通信进行身份验证。
由于我的公司原因,我没有更新 webdriver 的选项 policy.So 我已经下载 chrome 驱动程序并正在使用它。
量角器:5.4.2
Chrome: 74.0.3729.169
Chrome 驱动程序:chromedriver_74.0.3729.6_win32
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const {SpecReporter} = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 30000,
chromeDriver: '../lib/chromedriver_74.0.3729.6_win32.exe',
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome',
'acceptInsecureCerts': true,
'acceptSslCerts': true,
chromeOptions: {
useAutomationExtension: false,
args: ['--headless']
}
},
framework: 'jasmine',
directConnect: true,
troubleshoot: true,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
defaultTimeoutInterval: 2500000,
print: function () {
}
},
onPrepare: function () {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
}
};
但我收到如下错误:
[0712/104633.475:ERROR:ssl_client_socket_impl.cc(946)] handshake failed; returned -1, SSL error code 1, net_error -117 [0712/104633.548:INFO:CONSOLE(27396)] "Http failure response for https://localhost:25000/app/api/disciplines: 0 Unknown Error", source: http://localhost:8082/app/main.js (27396)
尝试将 --allow-insecure-localhost
and/or --ignore-certificate-errors
添加到 args
数组。
chromeOptions: {
args: [
'--headless',
'--ignore-certificate-errors',
'--allow-insecure-localhost'
]
}
我可以使用以下方法解决它:
通过编辑注册表,我能够停止弹出窗口并执行 auto-select 并且可以 运行 我的测试成功。