경로 충돌 문제 해결
This commit is contained in:
@ -5,6 +5,10 @@ from selenium.webdriver.common.action_chains import ActionChains
|
||||
from datetime import datetime
|
||||
import os
|
||||
import time
|
||||
import tempfile
|
||||
|
||||
# 크롬 프로세스 정리
|
||||
os.system("pkill chrome || true")
|
||||
|
||||
# 현재 스크립트 경로 기준 저장
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
@ -12,7 +16,11 @@ script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 브라우저 옵션 설정
|
||||
options = Options()
|
||||
options.add_argument('--headless')
|
||||
options.add_argument('--window-size=1802,1467')
|
||||
options.add_argument('--no-sandbox')
|
||||
options.add_argument('--disable-dev-shm-usage')
|
||||
options.add_argument('--disable-gpu')
|
||||
options.add_argument('--remote-debugging-port=9222')
|
||||
options.add_argument(f'--user-data-dir={tempfile.mkdtemp()}') # 고유한 프로필 경로
|
||||
|
||||
driver = webdriver.Chrome(options=options)
|
||||
driver.get('https://www.weather.go.kr/w/weather/forecast/short-term.do#dong/4148026200/37.73208578534846/126.79463099866948')
|
||||
|
||||
Reference in New Issue
Block a user