0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【解決】chromedriver-binary selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 84

Last updated at Posted at 2021-02-23

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 84 ERROR: Could not find a version that satisfies the requirement chromedriver-binary==88.0.4324.182ERROR: No matching distribution found for chromedriver-binary==88.0.4324.182

今回のエラーたち。調べると記事は多いみたいだがイマイチ解決しない

原因

原因はみんな知っての通り、chromedriver-binaryとChromeのバージョンが一致しないこと。とにかくメジャーバージョンが一致しないと動いてくれないんだそう💩
そもそもなぜ人間がchromeバージョンを調べて、そのバージョンに近しいchromedriver-binaryのバージョンをインストールしなきゃいけない👿めんどくさい

そんなもん pip が勝手にやってくれ!!!!!!!

そんなことを考えていたら、そんなコマンドがあった

解決

$ pip install --upgrade pip             // pipを最新にする
$ pip install --upgrade --force-reinstall chromedriver-binary-auto             // chromedriver-binaryを現在のchromeバージョンに合わせてインストール

ログ

$ pip install --upgrade --force-reinstall chromedriver-binary-auto
Collecting chromedriver-binary-auto
  Downloading chromedriver-binary-auto-0.1.tar.gz (4.3 kB)
Using legacy 'setup.py install' for chromedriver-binary-auto, since package 'wheel' is not installed.
Installing collected packages: chromedriver-binary-auto
    Running setup.py install for chromedriver-binary-auto ... done
Successfully installed chromedriver-binary-auto-0.1

そもそもGoogle Chromeをインストールできてない人は以下を実行してね(Mac)

$ brew install google-chrome --cask

プロセス

クローラー実行後 driver = webdriver.Chrome() でエラー

$ python attendance.py
Traceback (most recent call last):
  File "attendance.py", line 8, in <module>
    driver = webdriver.Chrome()
  File "/Users/jun/.pyenv/versions/3.7.5/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/Users/jun/.pyenv/versions/3.7.5/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Users/jun/.pyenv/versions/3.7.5/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Users/jun/.pyenv/versions/3.7.5/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Users/jun/.pyenv/versions/3.7.5/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 84

chromeのバージョンと同じchromedriver-binaryバージョンをインストールしてみるがすんごいエラーが出る

$ pip install chromedriver-binary==88.0.4324.182
ERROR: Could not find a version that satisfies the requirement chromedriver-binary==88.0.4324.182 (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)
ERROR: No matching distribution found for chromedriver-binary==88.0.4324.182
WARNING: You are using pip version 20.2.2; however, version 21.0.1 is available.
You should consider upgrading via the '/Users/jun/.pyenv/versions/3.7.5/bin/python3.7 -m pip install --upgrade pip' command.

上のエラーで「pipを最新にして」と言われていたのでpipを最新にする

$ pip install --upgrade pip
Collecting pip
  Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 1.4 MB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.2
    Uninstalling pip-20.2.2:
      Successfully uninstalled pip-20.2.2
Successfully installed pip-21.0.1

pipを最新にしたので再度chromeのバージョンと同じchromedriver-binaryバージョンをインストールしてみるもうまくいかない

$ pip install chromedriver-binary==88.0.4324.182
ERROR: Could not find a version that satisfies the requirement chromedriver-binary==88.0.4324.182
ERROR: No matching distribution found for chromedriver-binary==88.0.4324.182

冒頭のログ参照

以上です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?