Tutorial & Training
Selenium DevToolsActivePort file doesn't exist
TL&D
2019. 9. 22. 01:00
728x90
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
저는 개발컴(Kali Linux)에서 windows 10에서 작성한 python selenium 코드를 옮겨와서 실행하는데
chromedriver 에서 오류를 뿜더군요...
뭐 여타 블로그들을 보면 'Chrome Driver가 새 Browser 를 초기화 할 수 없다' 고 하더군요.
? DevToolsActivePort file doesn't exist
직역만 해봐도 개발도구 포트 파일을 찾을 수 없음! 인데 이게 어떻게 초기화 할 수 없다고 라는 말이 바로나오는지
이해가 안되네요...
어쨋든 해결법은 간단합니다.
말 그대로 개발 포트를 찾을 수 없는 것이니 개발 포트 옵션을 할당해 주면 됩니다.
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless") # Background(CLI) 동작 사용
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument("--remote-debugging-port=9222") # 이 부분이 핵심
binary = "chromedriver"
self.driver = webdriver.Chrome(binary, chrome_options=chrome_options)
728x90