Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 <module>
  driver = webdriver.Firefox()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
  self.service.start()
  File "C:\Python27\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
  os.path.basename(self.path), self.start_error_message)
  WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

please give information step by step thoroughly please actually i am learner

like image 779
pratap Avatar asked Oct 22 '16 05:10

pratap


3 Answers

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

like image 164
ahereza Avatar answered Oct 12 '22 23:10

ahereza


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()
like image 37
Tushar Goyal Avatar answered Oct 13 '22 00:10

Tushar Goyal


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

like image 41
Emily Chen Avatar answered Oct 12 '22 22:10

Emily Chen