So i'm working on a little project where i scrape yahoo news comments.
There has a error when I try to install chromedriver.
I wonder that I made some mistake, I would be appreciate it if someone could tell me.
(base) PS C:\Users\aaa> conda install chromedriver
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:
- chromedriver
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/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.
than when I downloaded the file from <sites.google.com/chromium.org/driver> and open the exe file, that showed
Starting ChromeDriver 93.0.4577.63 (ff5c0da2ec0adeaed5550e6c7e98417dac77d98a-refs/branch-heads/4577@{#1135}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
when I run the code
from selenium import webdriver
driver = webdriver.Chrome()
that showed the error:
WebDriverException: Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.19043 x86_64)
I wonder if the chrome version is too old.
what should I do?
I hope this solves the problem, but I found this command here
conda install -c conda-forge python-chromedriver-binary
EDIT:
the chrome driver requires that you specify google chrome and chromedriver paths.
first you need to download the chromedriver from here , then in your python code add the paths as follows:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.binary_location = r"<YOUR_CHROME_PATH>\chrome.exe"
chrome_driver_path = r"<PATH_TO_CHROME_DRIVER>\chromedriver.exe>"
browser = webdriver.Chrome(chrome_driver_path, options=options)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.