/opt/homebrew/bin/python3.10 /Users/ivan/PycharmProjects/Auto_Order2/main.py Traceback (most recent call last): File "/Users/ivan/PycharmProjects/Auto_Order2/main.py", line 46, in <module> driver = webdriver.Chrome(service=service, options=options) File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__ super().__init__( File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 53, in __init__ self.service.start() File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 109, in start self.assert_process_still_running() File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 122, in assert_process_still_running raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}") selenium.common.exceptions.WebDriverException: Message: Service /Users/ivan/.wdm/drivers/chromedriver/mac64/116.0.5845.110/chromedriver-mac-arm64/chromedriver unexpectedly exited. Status code was: -9 Process finished with exit code 1
일단 이 문제는 셀레니움을 활용하는 아래의 모든 코드에서 동시에 발생했다.
- 지난 Python Selenium 으로 크롤링해서 구글시트에 담는 코드 ( 지금 보러가기 )
- 자동으로 상품을 주문하는 Python Selenium 봇 (지금 보러가기)
이놈의 Status code -9가 도대체 뭔지 많은 시간을 해멨다.
결론부터 말하자면 더이상 크롬드라이버를 지정하지 않아도 되는데 지정해서 생긴문제다.
아래처럼 코드(일부)에서 모든 버전컨트롤 구문을 삭제하고 run 하니 잘 되었다.
#from webdriver_manager.chrome import ChromeDriverManager
#service = Service(executable_path=ChromeDriverManager().install()) #Chrome webdriver를 최신버전으로 사용
#service = Service(executable_path=ChromeDriverManager(version="116.0.5845.96").install())
driver = webdriver.Chrome(options=options)
dirver = webdriver.Chrome(service = service, options = options) 였던 것도 위와 같이 수정.
나는 webdriver_manager를 통해 최신 chrome driver를 다운받고 그 걸 사용하는 코드를 구성했으나, 셀레니움 작년 11월에 출시한 4.6 버전부터는 더 이상 크롬드라이버 버전을 맞출 필요가 없어졌다고 한다. 지금 내 셀레니움 버전은 4.12.0
아마 지금까지 유예기간을 주었고 이제부터는 예전 코드가 더 이상 작동하지 않도록 수정된 것으로 추측해볼 수 있다.
난 실행하고 있는 프로세스가 없는데 왜 자꾸 프로세스가 이미 실행중인지를 확인하라는건지 모르겠어서 구글링에 많은 시간을 쏟았음 ㅠㅠ 이 유튜브 쇼츠를 보고 어랏..? 하고 적용! 감사합니다 유튜버님!
댓글
댓글 쓰기