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

后端 未结 5 777
梦谈多话
梦谈多话 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: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()
    

提交回复
热议问题