feat: ChromeDriver 경로 설정 및 로그 디렉토리 생성 추가

- ChromeDriver 경로를 환경 변수로 설정하여 유연한 드라이버 관리 가능
- CI 및 로컬 환경에서 로그 디렉토리를 자동 생성하도록 수정
- requirements.txt에서 selenium 버전을 명시적으로 지정하여 호환성 강화
This commit is contained in:
hyeonggil
2026-03-27 23:33:55 +09:00
parent decc206725
commit 384b9aa931
3 changed files with 11 additions and 3 deletions

View File

@@ -19,6 +19,9 @@ import tempfile
import urllib.request
from datetime import datetime
# 로그 디렉토리는 CI/로컬 어디서든 보장
os.makedirs("logs", exist_ok=True)
# .env 파일 자동 로드
try:
from dotenv import load_dotenv
@@ -89,7 +92,10 @@ def create_driver():
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
driver = webdriver.Chrome(options=options)
chromedriver_path = os.environ.get("CHROMEDRIVER_PATH", "")
service = Service(executable_path=chromedriver_path) if chromedriver_path else None
driver = webdriver.Chrome(service=service, options=options)
# 종료 시 정리할 수 있도록 임시 프로필 경로 저장
driver._chrome_user_data_dir = chrome_user_data_dir
driver._chrome_user_data_dir_auto_created = auto_created_profile

View File

@@ -1,2 +1,2 @@
selenium
selenium>=4.6.0
python-dotenv