0
0

More than 1 year has passed since last update.

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.

Last updated at Posted at 2021-10-02

スクレイピングをするPythonスクリプトを久しぶりに動作させたら以下のエラーが出た.

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

自分のChromeのバージョンとchrome driverのバージョンが異なる場合にエラーになるみたい.

import chromedriver_binary

をすることで直接PATHを指定する必要はないとのこと.
ただし正しいバージョンのChrome Driverをインストールする必要がある.

Chromeでchrome://settings/helpにアクセスすると自分のChromeのバージョンを確認できるので,そのバージョンのDriverをインストールする

今回自分は
94.0.4606.61
だったので,

$ pipenv install chromedriver-binary==94.0.4606.61

とすればOK

ピッタリのバージョンがない場合にはエラーが出るけど,エラーメッセージの中で指定できるバージョン一覧が出てくる

以下はバージョン98.0.4758.102.0を指定したけどなかったときのエラーメッセージ

Error:  An error occurred while installing chromedriver-binary==98.0.4758.109!
Error text: 
ERROR: Could not find a version that satisfies the requirement chromedriver-binary==98.0.4758.109 (from versions: 2.29.1, 2.31.1, 2.33.1, 2.34.0, 2.35.0, 2.35.1, 2.36.0, 2.37.0, 2.38.0, 2.39.0, 2.40.1, 2.41.0, 2.42.0, 2.43.0, 2.44.0, 2.45.0, 2.46.0, 70.0.3538.16.0, 70.0.3538.67.0, 70.0.3538.97.0, 71.0.3578.30.0, 71.0.3578.33.0, 71.0.3578.80.0, 71.0.3578.137.0, 72.0.3626.7.0, 72.0.3626.69.0, 73.0.3683.20.0, 73.0.3683.68.0, 74.0.3729.6.0, 75.0.3770.8.0, 75.0.3770.90.0, 75.0.3770.140.0, 76.0.3809.12.0, 76.0.3809.25.0, 76.0.3809.68.0, 76.0.3809.126.0, 77.0.3865.10.0, 77.0.3865.40.0, 78.0.3904.11.0, 78.0.3904.70.0, 78.0.3904.105.0, 79.0.3945.16.0, 79.0.3945.36.0, 80.0.3987.16.0, 80.0.3987.106.0, 81.0.4044.20.0, 81.0.4044.69.0, 81.0.4044.138.0, 83.0.4103.14.0, 83.0.4103.39.0, 84.0.4147.30.0, 85.0.4183.38.0, 85.0.4183.83.0, 85.0.4183.87.0, 86.0.4240.22.0, 87.0.4280.20.0, 87.0.4280.87.0, 87.0.4280.88.0, 88.0.4324.27.0, 88.0.4324.27.1, 88.0.4324.96.0, 89.0.4389.23.0, 90.0.4430.24.0, 91.0.4472.19.0, 91.0.4472.101.0, 92.0.4515.43.0, 92.0.4515.107.0, 93.0.4577.15.0, 93.0.4577.63.0, 94.0.4606.41.0, 94.0.4606.61.0, 94.0.4606.113.0, 95.0.4638.10.0, 95.0.4638.17.0, 95.0.4638.54.0, 95.0.4638.69.0, 96.0.4664.18.0, 96.0.4664.35.0, 96.0.4664.45.0, 97.0.4692.20.0, 97.0.4692.36.0, 97.0.4692.71.0, 98.0.4758.48.0, 98.0.4758.80.0, 98.0.4758.102.0, 99.0.4844.17.0, 99.0.4844.35.0)
ERROR: No matching distribution found for chromedriver-binary==98.0.4758.109

おそらく近いバージョンを指定すればなんとかなるはず.

バージョンは適当に読み替えてください.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0