Inicialize a instância do driver depois de definir a propriedade do sistema.
System.setProperty("webdriver.gecko.driver", "/home/myacc/eclipse/jee-
neon2/eclipse/geckodriver");
Eu uso o Ubuntu 16.10, e eu configurei o Selenium 3.0.1. Eu instalei o geckodriver e usei o seguinte
WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver", "/home/myacc/eclipse/jee-neon2/eclipse/geckodriver");
driver.get("www.google.co.in");
No entanto, ainda recebo o seguinte erro:
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
Inicialize a instância do driver depois de definir a propriedade do sistema.
System.setProperty("webdriver.gecko.driver", "/home/myacc/eclipse/jee-
neon2/eclipse/geckodriver");