Back to feed
Renewal·마흔의 생활코딩

[selenium] Chrome driver shuts down right after launch (even when versions match)

NS
normalstory
cover image

When using selenium, even when you install the same chromedriver version as the Chrome browser, the browser shuts down immediately upon code execution. 

Original code

# 1) pipenv install selenium
# 2) https://chromedriver.chromium.org/downloads 
#    Download a driver matching your Chrome version, and unzip it in any folder

from selenium import webdriver
browser = webdriver.Chrome("C:/Users/everp/Documents/env_p3/chromedriver.exe")
browser.get("https://www.naver.com")

 

 

Improved code 

# 1) pipenv install selenium
# 2) https://chromedriver.chromium.org/downloads 
#    Download a driver matching your Chrome version, and unzip it in any folder
# 3) pipenv install webdriver-manager

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

# Auto-update Chrome driver
from webdriver_manager.chrome import ChromeDriverManager

# Prevent browser from closing
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)

# Suppress unnecessary error messages
chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"])
service = Service(executable_path=ChromeDriverManager().install())
driver = webdriver.Chrome(service=service, options=chrome_options,executable_path="C:/Users/everp/Documents/env_p3/chromedriver.exe")

# Navigate to the target webpage
driver.get("https://www.naver.com")

 

 

 

 

 

 

Code that keeps changing and improving. Complacency is the end. That's why the world of living-coding is so attractive and fair! hahaha


The most important official documentation

https://www.selenium.dev/selenium/docs/api/py/index.html

 

Selenium Client Driver — Selenium 4.8 documentation

 

www.selenium.dev

 

This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Steadily, for the long haul, without burning out

Mar 31, 2026·9 min
Renewal

Tech-life balance

Feb 7, 2026·3 min
Renewal

Humanality, by Park Jeong-ryeol

Feb 7, 2026·11 min