Selenium Chrome 자동 종료 방지
Selenium Chrome 브라우저 자동 종료 방지 설정
Selenium 스크립트 실행 후 Chrome 브라우저가 자동으로 닫혀서 불편했지? 디버깅이나 추가 수동 조작이 필요할 때 유용해.
ChromeOptions에 detach 옵션을 True로 설정하면 스크립트가 끝나도 브라우저 창이 계속 열려있게 돼.
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=options)
이제 스크립트 종료 후에도 브라우저가 닫히지 않고 유지될 거야.
여기서 배울 것
- Selenium `detach` 옵션으로 Chrome 자동 종료 방지
- `ChromeOptions` 객체 활용법
- 스크립트 종료 후 브라우저 디버깅 및 수동 조작 가능
원본 파일 보기 (.claude/skills/tn-selenium-chrome-detach/SKILL.md)
---
name: Selenium Chrome 자동 종료 방지
description: This skill should be used when the user asks to prevent the Chrome browser from automatically closing after a Selenium script execution, allowing it to remain open for debugging or further manual interaction.
version: 1.0.0
source: /home/son/prj/resume/backup_notes_260317/notion/Tech Note/Selenium if chrome shutdown automatically 9759247a171c4e988a9a777c99e04308.md
---
# Selenium / if chrome shutdown automatically
```python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=options, executable_path="path/to/executable")
```
[https://stackoverflow.com/questions/58900800/after-executing-selenium-python-code-google-chrome-closes-automatically](https://stackoverflow.com/questions/58900800/after-executing-selenium-python-code-google-chrome-closes-automatically)