A
firefox_capabilities = webdriver.DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/usr/bin/firefox'
driver = webdriver.Firefox(executable_path=r'/usr/local/bin/geckodriver', desired_capabilities=firefox_capabilities)
driver.close()