title: FAILED CONFIGURATION: @BeforeMethod setup org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
body: <p>I found few similar issues here(
  <a href="https://stackoverflow.com/questions/41352248/sessionnotfoundexception-session-id-is-null-using-webdriver-after-calling-quit/48654830?noredirect=1#comment84307834_48654830">SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()? (Selenium)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/42823201/org-openqa-selenium-nosuchsessionexception-session-id-is-null-using-webdriver">org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?</a>
  )
  but none of them did not help me to solve my issue.
  Any help or advice will be appreciated.</p>
  
  <p>In my case I am using TestNG.
  I have created Main Class</p>
  
  <pre><code>package base;
  
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.util.Properties;
  
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.testng.annotations.AfterSuite;
  import org.testng.annotations.BeforeSuite;
  import org.testng.annotations.BeforeTest;
  
  public class MainClass {
  
        public WebDriver driver;
        public Properties CONFIG;
        public Properties XPATH;
  
      @BeforeSuite
      public void initialization() throws IOException {   
          String chromeDriverLocation = System.getProperty("user.dir")+"/src/main/java/driverlocation/chromedriver.exe";
          System.setProperty("webdriver.chrome.driver", chromeDriverLocation);
  
          driver = new ChromeDriver();
          System.out.println("Web Driver initilization has started...");
          System.out.println("In the before suite...");
  
          CONFIG = new Properties();
          String configLocation = System.getProperty("user.dir")+"/src/main/java/base/Config.properties";
          FileInputStream ip = new FileInputStream(configLocation);
          CONFIG.load(ip);
  
          XPATH = new Properties();
          String xpathLocation = System.getProperty("user.dir")+"/src/main/java/base/xpath.properties";
          FileInputStream xpathIp = new FileInputStream(xpathLocation);
          XPATH.load(xpathIp);
      }
       @AfterSuite
          public void tearDown() {
          System.out.println("Web Driver is closing...");
          System.out.println("it is epic...");
          driver.quit();
  }
  }
  </code></pre>
  
  <p>And I have class with test which extends Main.Class</p>
  
  <pre><code>package Test.TileSearch;
  
  import org.testng.annotations.Test;
  
  import base.MainClass;
  
  import org.testng.annotations.BeforeMethod;
  import org.openqa.selenium.By;
  import org.testng.annotations.AfterMethod;
  
  
  public class Tile1City1 extends MainClass  {
  
  
       @BeforeMethod 
         public void setup() throws Exception {
            driver.get(CONFIG.getProperty("urlcentura"));
            driver.manage().window().maximize();
        }
  
        @AfterMethod 
        public void tearDown() {
            driver.quit();
        }
  
  
         @Test
        public void main1() throws Exception  
              driver.findElement(By.xpath().click();
              driver.findElement(By.xpath().click();
              driver.findElement(By.xpath().click();
  
              if(!driver.findElements(By.partialLinkText("Tile")).isEmpty()){
                      System.out.println("Tile is available there");
                  }else{
                      System.out.println("Tile is not available there");
                  }
        }
  
        @Test
        public void main1() throws Exception  
              driver.findElement(By.xpath().click();
              driver.findElement(By.xpath().click();
              driver.findElement(By.xpath().click();
  
              if(!driver.findElements(By.partialLinkText("Tile")).isEmpty()){
                      System.out.println("Tile is available there");
                  }else{
                      System.out.println("Tile is not available there");
                  }
        }
      }
  </code></pre>
  
  <p>And here is error in console</p>
  
  <pre><code>[RemoteTestNG] detected TestNG version 6.13.1
  Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 11302
  Only local connections are allowed.
  Feb 06, 2018 8:13:19 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  INFO: Detected dialect: OSS
  Web Driver initilization has started...
  In the before suite...
  Abaco is available there
  FAILED CONFIGURATION: @BeforeMethod setup
  org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
  Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
  System info: host: 'EARL', ip: '192.168.1.85', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
  Driver info: driver.version: RemoteWebDriver
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:131)
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
      at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
      at Test.CenturaSearch.AbacoMontreal.setup(AbacoMontreal.java:16)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
      at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:516)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
      at org.testng.TestRunner.privateRun(TestRunner.java:648)
      at org.testng.TestRunner.run(TestRunner.java:505)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
      at org.testng.SuiteRunner.run(SuiteRunner.java:364)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
      at org.testng.TestNG.runSuites(TestNG.java:1028)
      at org.testng.TestNG.run(TestNG.java:996)
      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
  
  SKIPPED CONFIGURATION: @AfterMethod tearDown
  PASSED: main
  SKIPPED: main1
  org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
  Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
  System info: host: 'EARL', ip: '192.168.1.85', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
  Driver info: driver.version: RemoteWebDriver
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:131)
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
      at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
      at Test.CenturaSearch.AbacoMontreal.setup(AbacoMontreal.java:16)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
      at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:516)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
      at org.testng.TestRunner.privateRun(TestRunner.java:648)
      at org.testng.TestRunner.run(TestRunner.java:505)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
      at org.testng.SuiteRunner.run(SuiteRunner.java:364)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
      at org.testng.TestNG.runSuites(TestNG.java:1028)
      at org.testng.TestNG.run(TestNG.java:996)
      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
  
  
  ===============================================
      Default test
      Tests run: 2, Failures: 0, Skips: 1
      Configuration Failures: 1, Skips: 1
  ===============================================
  
  
  ===============================================
  Default suite
  Total tests run: 2, Failures: 0, Skips: 1
  Configuration Failures: 1, Skips: 1
  ===============================================
  </code></pre>
  
  <p>Only one test is running, other always skips. 
  Basically the problem is that I am using static attributes for WebDriver, which shouldn't be shared between different test runs.
  Anyone knows how to fix that?</p>