I'm following the tutorial here and I cannot get selenium to open Firefox. I have tried both:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://localhost:8000')
assert 'Django' in browser.title
and
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
browser = webdriver.Firefox(firefox_binary=FirefoxBinary(
firefox_path='/Applications/Firefox.app/Contents/MacOS/firefox-bin'
))
assert 'Django' in browser.title
and
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
browser = webdriver.Firefox(firefox_binary=FirefoxBinary(
firefox_path='/Applications/Firefox'
))
assert 'Django' in browser.title
With each version I get the same error message in console:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "functional_tests.py", line 5, in <module>
firefox_path='/Applications/Firefox.app/Contents/MacOS/firefox-bin'
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/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 ignored in: <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x10312ed30>>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 163, in __del__
self.stop()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
I've exhausted every seemingly relevant search I can think of and have yet to find a solution. The version of Firefox I'm directing to (45) should be compatible with Selenium according to the Tutorial... I can't find anything I missed in the tutorial that may be causing this either.
sudo pip3 install --upgrade seleniumso I'm not sure exactly but I would think it'd the most recent stable version (3.0.1?)