title: Unable to launch Firefox browser from Selenium Webdriver version 3.4.0
body: <p>I am facing an issue wherein I am unable to launch firefox from Selenium Webdriver version 3.4.0 from my Windows operating system (Windows 7) which is 64 bit.
  Currently, firefox version 52.0.2 is installed on my machine.
  I have also added selenium jar files to the library, still it is showing error.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>package sanity;
  
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  
  public class Login
  {
          public static void main(String[] args)    
          {
              WebDriver driver=new FirefoxDriver();    
              driver.close(); 
          }
  }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>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:738)
      at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
      at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
      at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
      at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330)
      at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:108)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:104)
      at sanity.Login.main(Login.java:18)
  </code></pre>
  
  <p>After this, I downloaded GeckoDriverService form SeleniumHQ.org and ran below code, now after running below updated code with the Geckodriver path, firefox browser is getting launched but not closing automatically. Also I am getting some message in console.</p>
  
  <p><strong>Code:</strong>    </p>
  
  <pre><code>package sanity;
  
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  
  public class Login 
  {
  
          public static void main(String[] args) 
          {
  
            String Firefoxdriverpath="C://Users//Ashish//Downloads//geckodriver-v0.16.0-win64//geckodriver.exe";
  
              System.setProperty("webdriver.gecko.driver", Firefoxdriverpath);
  
              WebDriver driver=new FirefoxDriver();
  
              driver.close(); 
          }
  
  }
  </code></pre>
  
  <p><strong>Console:</strong></p>
  
  <pre><code>    1492944489305   geckodriver INFO    Listening on 127.0.0.1:12059
  1492944489973   geckodriver::marionette INFO    Starting browser \\?\C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"]
  1492944491445   addons.manager  ERROR   startup failed: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: resource://gre/modules/FileUtils.jsm :: FileUtils_getDir :: line 70"  data: no] Stack trace: FileUtils_getDir()@resource://gre/modules/FileUtils.jsm:70 &lt; FileUtils_getFile()@resource://gre/modules/FileUtils.jsm:42 &lt; AddonManagerInternal.validateBlocklist()@resource://gre/modules/AddonManager.jsm:700 &lt; AddonManagerInternal.startup()@resource://gre/modules/AddonManager.jsm:870 &lt; this.AddonManagerPrivate.startup()@resource://gre/modules/AddonManager.jsm:3033 &lt; amManager.prototype.observe()@resource://gre/components/addonManager.js:65
  JavaScript error: resource://gre/modules/AddonManager.jsm, line 1677: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
  1492944492505   Marionette  INFO    Listening on port 50231
  JavaScript error: resource://gre/modules/AddonManager.jsm, line 2585: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
  Apr 23, 2017 4:18:14 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  INFO: Detected dialect: W3C
  </code></pre>
  
  <p>Kindly help.</p>
  
  <p>Thanks,
  Ashish Jain</p>