Troubleshooting Common Python Selenium Errors and Workarounds

Hiding the Console Window on Windows (Selenium 4.0+)

To prevent the command prompt from appearing when running scripts on Windows, configure the service creation flags. This requires Selenium 4.0 or newer.

import subprocess
from selenium import webdriver
from selenium.webdriver.chrome.service import Service

# Path to your ChromeDriver executable
driver_executable_path = "./drivers/chromedriver.exe"

chrome_service = Service(executable_path=driver_executable_path)
# Hide the console window (Windows specific)
chrome_service.creation_flags = subprocess.CREATE_NO_WINDOW

browser = webdriver.Chrome(service=chrome_service)

Eliminating Certificate Errors with Selenium-Wire

When using Selenium-Wire, you may encounter CertVerifyProcBuiltin errors regarding a missing Selenium Wire CA issuer.

[ERROR:cert_verify_proc_builtin.cc] CertVerifyProcBuiltin for example.com failed:
----- Certificate i=1 (CN=Selenium Wire CA) -----
ERROR: No matching issuer found

To resolve this, you must import the Selenium-Wire root certificate into your browser's trust store. Even if running in headless mode, you typically need to perform this step via the GUI first or ensure the certificate is installed in the system store.

  1. Locate the ca.crt file provided by Selenium-Wire (or export it if necessary).
  2. Launch the browser manually.
  3. Navigate to Privacy and Security > Security > Manage Certificates.
  4. Select the Trusted Root Certification Authorities tab.
  5. Click Import, select the ca.crt file, and complete the wizard.

Driver and Browser Version Mismatch

The Chrome browser often updates automatically, which can cause a version mismatch with the locally installed chromedriver. For example, Chrome might update to 122.0.6261.95, while the driver remains on 122.0.6261.94. This mismatch often causes the script to crash or the browser to close immediately.

Official driver downloads might lag behind the latest browser release. To fix this, you can download a specific historical version of Chromium that matches your driver, or update the driver if a new version is available.

Resource for downloading specific Chromium versions: https://vikyd.github.io/download-chromium-history-version/#/

Fixing Instant Crash When Loading Extensions

A common mistake causing the browser to flassh open and close immediately is incorrectly passing the driver path as an extension.

Incorrect approach:

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

opts = Options()
# Incorrect: Passing the driver executable as an extension path
opts.add_extension('C:\\chromedriver.exe')

driver_service = Service('C:\\chromedriver.exe')

# This will likely crash immediately
driver = webdriver.Chrome(service=driver_service, options=opts)

Correct approach: Ensure the add_extension method receives a valid .crx file path, not the driver executable.

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

opts = Options()
# Correct: Load an actual browser extension file
# opts.add_extension('C:\\path_to_extension\\my_extension.crx')

driver_service = Service('C:\\chromedriver.exe')

driver = webdriver.Chrome(service=driver_service, options=opts)
driver.get("https://www.google.com")

Tags: python Selenium webdriver troubleshooting automation

Posted on Sat, 19 Sep 2026 16:51:06 +0000 by froggie81