Selenium に Chrome ドライバーが使用できない 質問する

Selenium に Chrome ドライバーが使用できない 質問する

Selenium 用の Chrome ドライバーの使用に問題があります。Chrome ドライバーをダウンロードして 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  

ご協力いただければ幸いです。

ベストアンサー1

実行可能ファイルを含むディレクトリ パスではなく、実行可能ファイルのパスを指定する必要があります。

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

おすすめ記事