WebDriverException: Message: 'geckodriver' executable needs to be in PATH

后端 未结 5 779
梦谈多话
梦谈多话 2021-02-03 11:32

os:windows 7 selenium version 3.0.1 mozilla firefox:48.0.2

Traceback (most recent call last):
  File \"C:\\Users\\LENOVO\\Desktop\\kk2.py\", line 4, in 

        
相关标签:
5条回答
  • 2021-02-03 12:05

    For Linux based system, download geckodriver. Extract it and copy the driver to /usr/local/bin and finally make it executable (chmod +x geckodriver).

    0 讨论(0)
  • 2021-02-03 12:10

    please check the answer:

    https://stackoverflow.com/a/37765661

    https://stackoverflow.com/a/40208762

    Shortly,

    From selenium 3.0, you have to explicitly download Marionette geckodriver for Firefox (which is similar to ChromeDriver for Chrome) and keep it in a place where the system can identify it. (like System PATH - environmental variables in Windows) or specify using language options.

    References:

    1. Download Marionette GeckoDriver
    2. https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
    3. https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette
    0 讨论(0)
  • 2021-02-03 12:13

    Linux(Ubuntu) Users should download the geckodriver and extract it in your project folder and while running your python script give the argument as

    executable_path="./geckodriver"
    

    Example:

    from selenium import webdriver
    
    class RunFFTests():
    
        def testMethod(self):
            # Initiate the driver instance
            driver = webdriver.Firefox(
                executable_path="./geckodriver")
    
            driver.get("http://www.letskodeit.com")
    
    ff = RunFFTests()
    ff.testMethod()
    
    0 讨论(0)
  • 2021-02-03 12:16

    For mac users use:

    brew install geckodriver
    
    0 讨论(0)
  • 2021-02-03 12:20

    I just download Gecko file and paste in where your python file is. It solves the problem!

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