问题描述
我已经添加了
ChromeOptions options = new ChromeOptions();
options.AddArgument("--ignore-certificate-errors-spki-list");
options.AddArgument("--ignore-ssl-errors");
options.AddArgument("test-type");
options.AddArguments("-incognito");
options.AddArgument("no-sandbox");
options.AddArgument("--start-maximized");
driver = new ChromeDriver(options);
但仍然得到:
ssl_client_socket_impl.cc(1061)] handshake failed error
如何从控制台抑制这个错误?
How to suppress this error from console?
推荐答案
这个错误信息...
[ERROR:ssl_client_socket_openssl.cc(855)] handshake failed; returned -1, SSL error code 1, net_error -2
...暗示 ChromeDriver 和 Chrome 浏览器 之间的握手失败 在某个时间点失败.
...implies that the handshake failed between ChromeDriver and Chrome Browser failed at some point.
此错误是由于 net::SSLClientSocketImpl::DoHandshake 和 net::SSLClientSocketImpl 在 ssl_client_socket_impl.ccnet::SSLClientSocketImpl::DoHandshake如下:
This error is generated due to net::SSLClientSocketImpl::DoHandshake and net::SSLClientSocketImpl implemented in ssl_client_socket_impl.cc net::SSLClientSocketImpl::DoHandshake as follows:
int SSLClientSocketImpl::DoHandshake() {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
int rv = SSL_do_handshake(ssl_.get());
int net_error = OK;
if (rv <= 0) {
int ssl_error = SSL_get_error(ssl_.get(), rv);
if (ssl_error == SSL_ERROR_WANT_CHANNEL_ID_LOOKUP) {
// The server supports channel ID. Stop to look one up before returning to
// the handshake.
next_handshake_state_ = STATE_CHANNEL_ID_LOOKUP;
return OK;
}
if (ssl_error == SSL_ERROR_WANT_X509_LOOKUP &&
!ssl_config_.send_client_cert) {
return ERR_SSL_CLIENT_AUTH_CERT_NEEDED;
}
if (ssl_error == SSL_ERROR_WANT_PRIVATE_KEY_OPERATION) {
DCHECK(ssl_config_.client_private_key);
DCHECK_NE(kSSLClientSocketNoPendingResult, signature_result_);
next_handshake_state_ = STATE_HANDSHAKE;
return ERR_IO_PENDING;
}
OpenSSLErrorInfo error_info;
net_error = MapLastOpenSSLError(ssl_error, err_tracer, &error_info);
if (net_error == ERR_IO_PENDING) {
// If not done, stay in this state
next_handshake_state_ = STATE_HANDSHAKE;
return ERR_IO_PENDING;
}
LOG(ERROR) << "handshake failed; returned " << rv << ", SSL error code "
<< ssl_error << ", net_error " << net_error;
net_log_.AddEvent(
NetLogEventType::SSL_HANDSHAKE_ERROR,
CreateNetLogOpenSSLErrorCallback(net_error, ssl_error, error_info));
}
next_handshake_state_ = STATE_HANDSHAKE_COMPLETE;
return net_error;
}
根据 ERROR:ssl_client_socket_openssl.cc 握手失败主要问题是 ChromeDriver 与 ChromeSSL 页面 握手时 handshake 的失败>.虽然 Chromium 团队通过 net_unittests
、content_tests
和 browser_tests
对 SSL 握手 进行了测试但并非详尽.依赖上游测试,一些用例被遗漏了.
As per ERROR:ssl_client_socket_openssl.cc handshake failed the main issue is the failure of handshake when ChromeDriver handshakes with SSL pages in Chrome. Though Chromium team conducts test for SSL handshake through net_unittests
, content_tests
, and browser_tests
but were not exhaustive. Some usecases are left out relying on the upstream tests.
此错误不会中断您的测试套件的执行,您可以暂时忽略此问题,直到它得到修复Chromium 团队.
This error won't interupt the execution of your Test Suite and you can ignore this issue for the time being till it is fixed by the Chromium Team.
这篇关于如何在 selenium c# ChromeDriver 中忽略 ssl_client_socket_impl.cc(1061)] 握手失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!