-1

Firefox Browser is not opening when i running a code:

browser = webdriver.Firefox()

it showing the error:

 Traceback (most recent call last):
  File "code.py", line 91, in <module>
    Main()
  File "code.py", line 74, in Main
    browser = webdriver.Firefox()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 144, in __init__
    self.service.start()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 81, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Help..

juanpa.arrivillaga
  • 77,035
  • 9
  • 115
  • 152
Shadab Ansari
  • 139
  • 1
  • 1
  • 9
  • always use the generic Python tag – juanpa.arrivillaga Oct 27 '17 at 22:03
  • Possible duplicate of [Selenium using Python - Geckodriver executable needs to be in PATH](https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path) – JeffC Oct 28 '17 at 01:13

1 Answers1

0

You have to set the path to the executable_path:

driver = webdriver.Firefox(executable_path=r'YourPathTo/geckodriver')

And make sure that your geckodriver is executable:

chmod +x geckodriver
Davide Patti
  • 3,201
  • 2
  • 15
  • 19