0

My code:

#!/usr/bin/python3

from selenium import webdriver

driver=webdriver.Firefox(executable_path=r'/usr/local/bin/geckodriver')
driver.get('http://www.python.org')

produces the following error:

ERROR : Message: Can not connect to the Service /usr/local/bin/geckodriver

My settings:

  • Mozilla Firefox 81.0
  • OS => Parrot sec(linux)
  • Python 3.8.6
  • geckodriver 0.27.0

How can I fix this?

Timus
  • 10,974
  • 5
  • 14
  • 28
  • Probably Your gecko path '/usr/local/bin/geckodriver' is not added to system environment path. https://stackoverflow.com/questions/40208051/selenium-using-python-geckodriver-executable-needs-to-be-in-path/46880071#46880071 – Jakub Ujvvary Oct 28 '20 at 12:24

1 Answers1

0

Move geckodriver file to /usr/bin and than change code as follow.

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)

Hope it helpful. It works in my side.

Xueming
  • 168
  • 1
  • 1
  • 11