1

I've been webscraping and for a variety of webpages certification worked well. That's why I don't understand the following problem:

That's my code:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager


driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.sportwetten.de/")

With following Error Code:

[18664:9880:0317/194904.232:ERROR:cert_issuer_source_aia.cc(34)] Error parsing cert retrieved from AIA (as DER):
ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

Thanks for you help!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
N8walker
  • 11
  • 1
  • 2

2 Answers2

3

This error message...

[18664:9880:0317/194904.232:ERROR:cert_issuer_source_aia.cc(34)] Error parsing cert retrieved from AIA (as DER):
ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

...indicates most likely an expired ca public cert in the browsers cert store.


Details

The error is defined in parse_certificate.cc:

namespace net {

namespace {

DEFINE_CERT_ERROR_ID(kCertificateNotSequence,
             "Failed parsing Certificate SEQUENCE");
DEFINE_CERT_ERROR_ID(kUnconsumedDataInsideCertificateSequence,
             "Unconsumed data inside Certificate SEQUENCE");
DEFINE_CERT_ERROR_ID(kUnconsumedDataAfterCertificateSequence,
             "Unconsumed data after Certificate SEQUENCE");
DEFINE_CERT_ERROR_ID(kTbsCertificateNotSequence,
             "Couldn't read tbsCertificate as SEQUENCE");
.
.
}
}

Solution

To get rid of the certificate errors you need to add the argument --ignore-certificate-errors through an instance of Options as follows:

from selenium import webdriver 
from selenium.webdriver.chrome.service import Service 
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options) 
driver.get("https://www.sportwetten.de/")

tl; dr

Chrome Root Program Policy

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

I was able to get around this by adding

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
Andy
  • 145
  • 11