Error message: “'chromedriver' executable needs to be available in the path”

前端 未结 25 1853
轻奢々
轻奢々 2020-11-22 05:15

I am using selenium with python and have downloaded the chromedriver for my windows computer from this site: http://chromedriver.storage.googleapis.com/index.html?path=2.15/

相关标签:
25条回答
  • 2020-11-22 05:47

    On Ubuntu:

    sudo apt install chromium-chromedriver
    

    On Debian:

    sudo apt install chromium-driver
    

    On macOS install https://brew.sh/ then do

    brew cask install chromedriver
    
    0 讨论(0)
  • 2020-11-22 05:47

    For mac osx users

        brew tap homebrew/cask
        brew cask install chromedriver
    
    
    0 讨论(0)
  • 2020-11-22 05:50

    I see the discussions still talk about the old way of setting up chromedriver by downloading the binary and configuring the path manually.

    This can be done automatically using webdriver-manager

    pip install webdriver-manager
    

    Now the above code in the question will work simply with below change,

    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    driver = webdriver.Chrome(ChromeDriverManager().install())
    

    The same can be used to set Firefox, Edge and ie binaries.

    0 讨论(0)
  • 2020-11-22 05:51

    Another way is download and unzip chromedriver and put 'chromedriver.exe' in C:\Program Files\Python38\Scripts and then you need not to provide the path of driver, just

    driver= webdriver.Chrome()

    0 讨论(0)
  • 2020-11-22 05:52

    You can test if it actually is in the PATH, if you open a cmd and type in chromedriver (assuming your chromedriver executable is still named like this) and hit Enter. If Starting ChromeDriver 2.15.322448 is appearing, the PATH is set appropriately and there is something else going wrong.

    Alternatively you can use a direct path to the chromedriver like this:

     driver = webdriver.Chrome('/path/to/chromedriver') 
    

    So in your specific case:

     driver = webdriver.Chrome("C:/Users/michael/Downloads/chromedriver_win32/chromedriver.exe")
    
    0 讨论(0)
  • 2020-11-22 05:53

    If you are working with robot framework RIDE. Then you can download Chromedriver.exe from its official website and keep this .exe file in C:\Python27\Scripts directory. Now mention this path as your environment variable eg. C:\Python27\Scripts\chromedriver.exe.

    Restart your computer and run same test case again. You will not get this problem again.

    0 讨论(0)
提交回复
热议问题