본문 바로가기
개발일지/selenium, BeautifulSoup, requests

WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home 에러

by 개발에정착하고싶다 2022. 6. 6.
320x100

WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

 

ChromeDriver - WebDriver for Chrome

WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server that implements the W3C WebDriver

chromedriver.chromium.org

에러에 관한 것이다.

나의 경우에는

1. !pip install selenium

을 통해서 selenium이 설치되어있었고

 

2. chrome driver download

를 통해서 현재 나의 버전에 맞게끔 윈도우 32비트로 파일을 다운 받았었다.

(본래 64비트가 맞는거지만 윈도우는 32비트밖에 없더라)

 

암튼 설치 후에 활용을 하려고 하는데

 

from selenium import webdriver

driver = webdriver.Chrome(executable_path='../data/chromedriver.exe')
driver.get('https://google.com')
 
이렇게 입력을 했고 결과는
 

WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

 

ChromeDriver - WebDriver for Chrome

WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server that implements the W3C WebDriver

chromedriver.chromium.org

라는 에러가 떴다.

대략 해석해보기를 " chrome.exe가 있는 경로를 추가할 필요가 있다."

뭐 이정도로 해석이 된다.

 

음.. 난 설치가 되어있는데?

 

아무튼 구글링을 통해서 찾은 방법을 시도해보다 보니

 

이전 파일에선 실행이 되었던것이

이번엔 실행이 안되는것이 이상했다.

 

따라서 이전에 썼던 코드를 복붙으로 붙여왔다.

 

그랬더니 실행이 되는것이다.

 

========================

그리고 자세히 봤더니

폴더 경로가 driver에 넣어놓은 파일을 불러와야하는데, data라는 경로로 잘못설정되어있더라.

그래서 이걸 바꾸어 주었더니 정상작동 되었다.

300x250