アナコンダ環境(condaを使用して)seleniumをインストールしたのですが、現在のChromeのバージョンに合わせることができません。
以下エラーまでの一連の流れです。
conda install selenium Collecting package metadata (current_repodata.json): done Solving environment: done # All requested packages already installed.
brew install chromedriver Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae Updated 18 formulae. Warning: Cask 'chromedriver' is already installed. To re-install chromedriver, run: brew reinstall chromedriver
from selenium import webdriver from time import sleep browser = webdriver.Chrome()
ここでエラーが発生します。
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 87 Current browser version is 96.0.4664.45 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
1. やりたいこと、解決したいこと
Jupyter labでSeleniumを使ったスクレピング
2. 実行したこと、コマンドエラー
エラーの内容は、ChromeDriverが対応するChromeバージョンとGoogle Chromeバージョンが対応していないことが原因だと考えられます。
エラー発生後、こちらのページを参考に、
conda install -c conda-forge python-chromedriver-binary==96.0.4664.45.0
を実行しました。
conda install -c conda-forge python-chromedriver-binary==96.0.4664.45.0 Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. PackagesNotFoundError: The following packages are not available from current channels: - python-chromedriver-binary==96.0.4664.45.0 Current channels: - https://conda.anaconda.org/conda-forge/osx-64 - https://conda.anaconda.org/conda-forge/noarch - https://repo.anaconda.com/pkgs/main/osx-64 - https://repo.anaconda.com/pkgs/main/noarch - https://repo.anaconda.com/pkgs/r/osx-64 - https://repo.anaconda.com/pkgs/r/noarch To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page.
しかし、この方法を試しても、以下のコマンドを実行してみても同じエラーが発生します。
conda install -c conda-forge python-chromedriver-binary
3. 環境
Chrome 96.0.4664.45
Python 3.7.3
Jupyter lab 1.0.2
conda 4.10.3
anaconda 1.7.2
anaconda navigator 2.1.1
4. 最後に
どなたか原因と解決策をご教示いただけないでしょうか。
よろしくお願いいたします。
