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

前端 未结 25 1857
轻奢々
轻奢々 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 06:14

    Some additional input/clarification for future readers of this thread, to avoid tinkering with the PATH env. variable at the Windows level and restart of the Windows system: (copy of my answer from https://stackoverflow.com/a/49851498/9083077 as applicable to Chrome):

    (1) Download chromedriver (as described in this thread earlier) and place the (unzipped) chromedriver.exe at X:\Folder\of\your\choice

    (2) Python code sample:

    import os;
    os.environ["PATH"] += os.pathsep + r'X:\Folder\of\your\choice';
    
    from selenium import webdriver;
    browser = webdriver.Chrome();
    browser.get('http://localhost:8000')
    assert 'Django' in browser.title
    

    Notes: (1) It may take about 5 seconds for the sample code (in the referenced answer) to open up the Firefox browser for the specified url. (2) The python console would show the following error if there's no server already running at the specified url or serving a page with the title containing the string 'Django': assert 'Django' in browser.title AssertionError

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