title: SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()? (Selenium)
body: <p>I am trying to write some selenium automated UI tests using Cucumber/Java.  If I have only one test in my feature file, everything works fine.  But if I add a second test, I get this error on <code>driver.get()</code>:</p>
  
  <pre><code>org.openqa.selenium.remote.SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()?
  Build info: version: '2.51.0', revision: '1af067dbcaedd7d2ab9af5151fc471d363d97193', time: '2016-02-05 11:20:57'
  </code></pre>
  
  <p>Basically, I am initializing the webdriver variable on the InitializeWebdriver class in one package, and then referencing it in the other (step definition) classes.  I did have the step definition listed below as a part of the InitializeWebdriver class, and it was working just fine (until moved on to a different step in a different class.  So I moved that step to a CommonSteps.java file to see if it would then fail, and it did.  So now I'm just stuck.  I was thinking of doing an <code>if (driver.equals(null))</code> in the <code>@Before</code> and doing a different action if had already been initialized, but I don't know what that other action would be.  </p>
  
  <p>Here is my code:</p>
  
  <p>tests.feature</p>
  
  <pre><code>Feature:  Two tests
  
  Background:
      Given I navigate to "http://www.google.com"
  
  Scenario: Test one
      When something happens
  
  Scenario: Test two
      When something else happens
  </code></pre>
  
  <p>InitializeWebDriver.java</p>
  
  <pre><code>public class InitializeWebDriver {
  
      public static WebDriver driver = null;
  
      @Before
      public void beforeScenario() {
          driver = new ChromeDriver();
      }
  
      @After
      public void afterScenario() {
          driver.quit();
      }
  }
  </code></pre>
  
  <p>CommonSteps.java</p>
  
  <pre><code>import myPackage.InitializeWebDriver;
  
  public class CommonSteps {
  
      static WebDriver driver = InitializeWebDriver.driver;
  
      @Given("^I navigate to \"([^\"]*)\"$")
      public void i_navigate_to(String url) {
          driver.get(value);
      }
  </code></pre>
  
  <p>Thanks!</p>