본문 바로가기
파이썬

파이썬 Selenium 용 Chrome 드라이버를 사용할 수 없습니다.

by º기록 2020. 12. 21.
반응형

Selenium 용 Chrome 드라이버를 사용하는 데 문제가 있습니다. chromedriver를 다운로드하여 C : \ Chrome에 저장했습니다.

driver = webdriver.Chrome(executable_path="C:/Chrome/")

그것을 사용하면 다음과 같은 오류가 발생합니다.

Traceback (most recent call last):
  File "C:\Python33\lib\subprocess.py", line 1105, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\selenium\webdriver\chrome\service.py", line 63, in start
    self.service_args, env=env, stdout=PIPE, stderr=PIPE)
  File "C:\Python33\lib\subprocess.py", line 817, in __init__
    restore_signals, start_new_session)
  File "C:\Python33\lib\subprocess.py", line 1111, in _execute_child
    raise WindowsError(*e.args)
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Wilson/Dropbox/xxx.py", line 71, in <module>
    driver = webdriver.Chrome(executable_path="C:/Chrome/")
  File "C:\Python33\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 59, in __init__
    self.service.start()
  File "C:\Python33\lib\site-packages\selenium\webdriver\chrome\service.py", line 68, in start
    and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.                 Please download from http://chromedriver.storage.googleapis.com/index.html  

어떤 도움을 주시면 감사하겠습니다.

 

해결 방법

 

실행 파일이 포함 된 디렉터리 경로가 아닌 실행 파일 경로를 지정해야합니다.

driver = webdriver.Chrome(executable_path=r"C:\Chrome\chromedriver.exe")

 

참조 페이지 https://stackoverflow.com/questions/22130109

 

 

반응형

댓글