如何在 selenium c# ChromeDriver 中忽略 ssl_client_socket_impl.cc(1061)] 握手失败

How to ignore ssl_client_socket_impl.cc(1061)] handshake failed in selenium c# ChromeDriver(如何在 selenium c# ChromeDriver 中忽略 ssl_client_socket_impl.cc(1061)] 握手失败)
本文介绍了如何在 selenium c# ChromeDriver 中忽略 ssl_client_socket_impl.cc(1061)] 握手失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经添加了

 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

...暗示 ChromeDriverChrome 浏览器 之间的握手失败 在某个时间点失败.

...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 握手失败主要问题是 ChromeDriverChromeSSL 页面 握手时 handshake失败>.虽然 Chromium 团队通过 net_unittestscontent_testsbrowser_testsSSL 握手 进行了测试但并非详尽.依赖上游测试,一些用例被遗漏了.

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)] 握手失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)