리그캣의 개발놀이터

[Linux] chrome driver 에러 발생시 해결방법 본문

프로그래밍 기본/서버 구축 및 관리

[Linux] chrome driver 에러 발생시 해결방법

리그캣 2019. 2. 12. 10:34

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

  (unknown error: DevToolsActivePort file doesn't exist)

  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

  (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 3.10.0-327.el7.x86_64 x86_64)



위와같은 에러가 났을때 조치방법은 

주석 처리한 기존 options 부분을



#options = webdriver.ChromeOptions()

#options.add_argument('headless')

#options.add_argument('window-size=1920x1080')

#options.add_argument("disable-gpu")

#options.add_argument("user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36")


chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument('--headless')

chrome_options.add_argument('--no-sandbox')

chrome_options.add_argument('--disable-dev-shm-usage')


driver = webdriver.Chrome(executable_path="/home/streamsets/crawlingExe/chromedriver",chrome_options=chrome_options)



위와같이 바꾸면 해결된다.. 또한 필자는 chromedriver를 wget을 통하여 다운받았는데


$wget https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip


후에 

$unzip 다운받은파일


하여 chromedriver를 설치해 주었다.

Comments