title: Selenium 3.7 : geckodriver : WebDriverException: org.apache.http.conn.HttpHostConnectException Connection Refused
body: <p>Recently I upgraded to Selenium 3.7. </p>
  
  <p>Code:</p>
  
  <pre><code>import org.openqa.selenium.WebDriver;  
  import org.openqa.selenium.firefox.FirefoxDriver;
  
  
  public static void main (String args[]){
  
      System.setProperty("webdriver.gecko.driver", 
      "/usr/local/bin/geckodriver");      
      WebDriver driver = new FirefoxDriver();
      driver.get("http://www.google.com");
      driver.quit();
    }
  </code></pre>
  
  <blockquote>
    <p><strong>Included Library:</strong></p>
    
    <p>selenium-java-3.7.1/selenium-server-standalone-3.7.1.jar</p>
    
    <p>selenium-java-3.7.1/libs/httpcore-4.4.6.jar</p>
    
    <p>selenium-java-3.7.1/libs/httpclient-4.5.3.jar</p>
    
    <p>selenium-java-3.7.1/libs/guava-23.0.jar</p>
    
    <p>selenium-java-3.7.1/libs/gson-2.8.2.jar</p>
    
    <p>selenium-java-3.7.1/libs/commons-logging-1.2.jar</p>
    
    <p>selenium-java-3.7.1/libs/commons-exec-1.3.jar</p>
    
    <p>selenium-java-3.7.1/libs/commons-codec-1.10.jar</p>
    
    <p>selenium-java-3.7.1/libs/byte-buddy-1.7.5.jar</p>
    
    <p>selenium-java-3.7.1/client-combined-3.7.1.jar</p>
    
    <p>selenium-java-3.7.1/client-combined-3.7.1-sources.jar</p>
    
    <p><strong>System environment:</strong></p>
    
    <p>Firefox 56.0.2</p>
    
    <p>Java 1.8 </p>
    
    <p>selenium-java-3.7.1</p>
    
    <p>selenium-server-standalone-3.7.1</p>
    
    <p>geckodriver - v0.19.1</p>
    
    <p><strong>Error trace log:</strong></p>
    
    <p>Usage:</p>
    
    <p>/usr/local/bin/geckodriver [OPTIONS] /usr/local/bin/geckodriver:
    Unknown option --port=8970 Exception in thread "main"
    org.openqa.selenium.WebDriverException:
    org.apache.http.conn.HttpHostConnectException: Connect to
    localhost:8970 [localhost/0:0:0:0:0:0:0:1,
    localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused (Connection
    refused) Build info: version: '3.7.1', revision: '8a0099a', time:
    '2017-11-06T21:07:36.161Z' System info: host:
    'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X',
    os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
    Driver info: driver.version: FirefoxDriver</p>
  </blockquote>
  
  <p>Any idea would be appreciated. Thank you.</p>
  
  <p>Update after trying Debanjan suggestion:</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>public static void main (String args[]){
      System.out.println("Debug 1");
      System.setProperty("webdriver.gecko.driver", 
      "/Users/maggie/Documents/ToolsQA/Libs/geckodriver");    
      System.out.println("Debug 2");
      WebDriver driver = new FirefoxDriver();
      System.out.println("Debug 3");
      driver.get("http://www.google.com");
      driver.quit();
    }
  </code></pre>
  
  <p>Include Library:</p>
  
  <blockquote>
    <p>selenium-server-standalone-3.7.1.jar</p>
  </blockquote>
  
  <p>System Environment:</p>
  
  <blockquote>
    <p>Firefox 56.0.2</p>
    
    <p>Java 1.8</p>
    
    <p>selenium-java-3.7.1</p>
    
    <p>selenium-server-standalone-3.7.1</p>
    
    <p>geckodriver 0.19.1</p>
    
    <p>Mac OS X', os.arch: 'x86_64', os.version: '10.12.6'</p>
  </blockquote>
  
  <p><strong>Error trace log:</strong></p>
  
  <blockquote>
    <p>Debug 1 Debug 2 Starting ChromeDriver 2.33.506106
    (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 2198 Only local
    connections are allowed. Exception in thread "main"
    org.openqa.selenium.WebDriverException: Timed out waiting for driver
    server to start. Build info: version: '3.7.1', revision: '8a0099a',
    time: '2017-11-06T21:07:36.161Z' System info: host:
    'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X',
    os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
    Driver info: driver.version: ChromeDriver     at
    org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192)
      at
    org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178)
      at
    org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
      at
    org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
      at
    org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
      at
    org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
      at
    org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
      at
    org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
      at
    org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123)
      at AutomationFrameWork.FirstTestCase.main(FirstTestCase.java:13)
    Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed
    out waiting for [<a href="http://localhost:2198/status]" rel="nofollow noreferrer">http://localhost:2198/status]</a> to be available after
    20005 ms  at
    org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
      at
    org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
      ... 9 more Caused by: java.util.concurrent.TimeoutException     at
    java.util.concurrent.FutureTask.get(FutureTask.java:205)  at
    com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:147)
      at
    org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
      ... 10 more</p>
  </blockquote>