My script is throwing a ton of SSL errors as below:
[19852:2032:0912/202419:ERROR:ssl_client_socket_impl.cc(1141)] handshake failed;
returned -1, SSL error code 1, net_error -100
[19852:2032:0912/202419:ERROR:ssl_client_socket_impl.cc(1141)] handshake failed;
returned -1, SSL error code 1, net_error -100
Everything works normally but the errors keep looping and eventually block the script causing it all to come to a halt.
I have tried to suppress the errors as below...but to no effect:
path_to_chromedriver = 'C:/Path/to/Chromedriver'
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')
browser = webdriver.Chrome(chrome_options=options, executable_path = path_to_chromedriver)
I am unsure if the error is in my code above if there is something I should add that isn't there, or whether these errors can actually be suppressed.
If it is helpful, this is an old piece of code that was working fine until a few days ago. The site in question added some ad.network scripts which caused some SSL certificate issues.
Any help appreciated.
You can try using the TrustManager
packages, here's a sample
SSLContext sslContext;
TrustManager[] tmTrustAllCerts = new TrustManager[]{
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
}
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
}
};
try {
sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, tmTrustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
}
catch(Exception e) {
System.out.println(e.getStackTrace());
}
change it from
browser = webdriver.Chrome(chrome_options=options, executable_path = path_to_chromedriver)
to
browser = webdriver.Chrome(executable_path = path_to_chromedriver, options=options)
this should solve your issue
This is due to the unsafe address error. You can ignore this by adding parameters of "--ignore-certificate-errors".
Take the case in robot framework-selenium as example:
Open Browser http://127.0.0.1/8000 Chrome executable_path=C:/path/to/chromedrive options=add_argument("--ignore-certificate-errors")
This will solve the problem you got. If you ignore this argument, there is an error of chance got a "ERROR:ssl_client_socket_impl.cc".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.