您需要使用Firefox的GeckoDriver。这对旧版本的Selenium 2.x并不需要,但是它需要Selenium 3.x
如果您的FF浏览器是32位或64位,则需要下载GeckoDriver。您还需要提供GeckoDriver和FirefoxBirnary路径。
System.setProperty("webdriver.gecko.driver","D:\\Firefox\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //This is the location where you have installed Firefox on your machine
FirefoxDriver driver = new FirefoxDriver(options);
driver.get("http://www.google.com");
您可以检查此链接了解更多信息 - - 你可以用它来启动浏览器的代码示例http://www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/
显示浏览器的配置代码 –