I have read previous questions asked on this topic and tried to follow the suggestions but I continue to get errors. On terminal, I ran
export PATH=$PATH:/Users/Conger/Documents/geckodriver-0.8.0-OSX
I also tried
export PATH=$PATH:/Users/Conger/Documents/geckodriver
When I run the following Python code
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/Users/Conger/Documents/Firefox.app'
driver = webdriver.Firefox(capabilities=firefox_capabilities)
I still get the following error
Python - testwebscrap.py:8
Traceback (most recent call last):
File "/Users/Conger/Documents/Python/Crash_Course/testwebscrap.py", line 11, in <module>
driver = webdriver.Firefox(capabilities=firefox_capabilities)
File "/Users/Conger/miniconda2/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/Users/Conger/miniconda2/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x1006df6d0>> ignored
[Finished in 0.194s]
To solve the Selenium error "WebDriverException: Message: 'geckodriver' executable needs to be in PATH", install and import the webdriver-manager module by running pip install webdriver-manager . The module simplifies management of binary drivers for different browsers.
Steps to Add a Path in System's PATH Environmental VariableClick on the Environment Variables button. From System Variables select PATH. Click on the Edit button. Paste the path of the GeckoDriver file.
The above code will search for the latest driver version to download and install into the system path. You can search for GeckoDriver in the path /usr/local/bin . Then use this path in executable_path for automating the browser.
you may downgrade your selenium by
pip install selenium==2.53.6
This has solved my issue
On mac:
brew install geckodriver
Homebrew is the most popular package manager for Mac OS X, you will need install XCode on your mac and it will be then accesible from your terminal.
You can follow this tutorial if required
First we know that gekodriver is the driver engine of Firefox,and we know that
driver.Firefox()
is used to open Firefox browser, and it will call the gekodriver engine ,so we need to give the gekodirver a executable permission.
so we download the latest gekodriver uncompress the tar packge ,and put gekodriver at the /usr/bin/
ok,that's my answer and i have tested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With