You must set the following property for all Firefox browsers, regardless of the version from selenium 3.0 onwards:
System.setProperty("webdriver.gecko.driver","path to geckodriver");
Geckodriver is now the default mechanism for automating Firefox. This is the Mozilla version for the driver for this browser and is required to automate versions of Firefox version 48 and higher.
Setting the path is required.
If you want to run tests in Firefox 47 or earlier, set the puppet parameter of the Firefox driver to false.
DesiredCapabilities d = new DesiredCapabilities(); d.setCapability("marionette", false); // to disable marionette. WebDriver driver = new FirefoxDriver(d);
source share