title: Error in fire fox selenium web driver
body: <p>Recently, bump into this issues with selenium firefox driver. 
  Thanks in advance </p>
  
  <p><strong>Set UP</strong> </p>
  
  <p>os.name: 'Mac OS X',</p>
  
  <p>os.arch: 'x86_64',</p>
  
  <p>os.version: '10.12.6', </p>
  
  <p>java.version: '1.8.0_131' </p>
  
  <p><strong>Firefox version</strong> 56.0.1 (64-bit)</p>
  
  <p><strong><em>Gecko Driver</em></strong>  Latest 0.19.0</p>
  
  <blockquote>
    <p>The error shows failed:
    org.openqa.selenium.SessionNotCreatedException: Tried to run command
    without establishing a connection</p>
  </blockquote>
  
  <p>I tried different ways to tackle it but always come with the same error. 
  1. update all the selenium test driver to the latest
  2. specify the directory export PATH = $PATH driverDir </p>
  
  <p><strong><em>My code</em></strong> </p>
  
  <pre><code>  package automationFramework;
  
  import org.apache.commons.io.FileUtils;
  import org.junit.*;
  import org.openqa.selenium.OutputType;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.openqa.selenium.remote.RemoteWebDriver;
  import org.openqa.selenium.safari.SafariDriver;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.concurrent.TimeUnit;
  
  import static org.junit.Assert.assertEquals;
  
  public class GeckoDriver {
      private static WebDriver driver;
      public static int random = 0;
      private String baseURL;
      // @BeforeClass : Executes only once for the Test-Class.
      @BeforeClass
      public static void setting_SystemProperties(){
          System.out.println("System Properties seting Key value.");
  
      }
      // @Before      : To execute once before ever Test.
      @Before
      public void test_Setup(){
          System.out.println("Launching Browser");
          if (random == 0) {
              System.out.println("Start Chrome Browser Testing ");
              System.setProperty("webdriver.gecko.driver", "/Users/Fannity/Desktop/Drivers/geckodriver");  // Chrome Driver Location.
              driver = new FirefoxDriver();
          }
  
          driver.manage().window().maximize();
          driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  
          System.out.println("Session ID : " + ((RemoteWebDriver) driver).getSessionId() );
      }
  
      @Test
      public void selenium_ScreenShot() throws IOException {
          baseURL = "https://www.google.com/";
          driver.get(baseURL);
          System.out.println("Selenium Screen shot.");
          File screenshotFile = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE);
          FileUtils.copyFile(screenshotFile, new File("/Users/Fannity/Desktop/JUNIT-Selenium.jpg"));
          random += 1;
      }
  
      // @After       : To execute once after ever Test.
      @After
      public void test_Cleaning(){
          System.out.println("Closing Browser");
          baseURL = null;
          driver.close();
          driver.quit();
      }
      // @AfterClass  : Executes only once before Terminating the Test-Class.
      @AfterClass
      public static void clearing_SystemProperties(){
          System.out.println("System Property Removing Key value.");
          System.clearProperty("webdriver.gecko.driver");
      }
  }
  </code></pre>
  
  <p><strong><em>ERROR</em></strong> </p>
  
  <p><a href="https://gist.github.com/Fenici/f82f885486de37ae110fda8d7430df6e" rel="nofollow noreferrer">https://gist.github.com/Fenici/f82f885486de37ae110fda8d7430df6e</a></p>