I don't see any significant error in your code block.
While working with Selenium 3.4.3, geckodriver v0.17.0, Mozilla Firefox 53.0 with Python 3.6.1 you can consider downloading the geckodriver and save it anywhere in your machine and configuring the absolute path of the geckodriver through executable_path
.
It is to be noted that the current Selenium-Python binding is unstable with geckodriver and looks to be Architecture specific. You can find the github discussion and merge here. So you may additionally need to pass the absolute path of the firefox binary as firefox_binary
argument while initializing the webdriver
Here is your own code block which executes well at my end:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary, executable_path="C:\\Utility\\BrowserDrivers\\geckodriver.exe")
driver.get('https://stackoverflow.com')