title: How to isolate Webdriver sessions for Cucumber scenarios with parallel execution?
body: <p>Current setup is maven executing cucumber in parallel, executing webdriver, executing chromedriver to test my software:</p>
  
  <p>Maven:</p>
  
  <pre><code>&lt;project&gt;
    ...
      &lt;build&gt;
        ...
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.0-M3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;parallel&gt;both&lt;/parallel&gt;
                      &lt;threadCount&gt;3&lt;/threadCount&gt;
                      &lt;runOrder&gt;random&lt;/runOrder&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Gherkin:</p>
  
  <pre><code>Function: Example
  
      Scenario: Example 1
         When I do something
         Then I expect something
  
      Scenario: Example 2
         When I do some other thing
         Then I expect some other thing
  </code></pre>
  
  <p>Cucumber-JVM / Webdriver-JVM / Chromedriver:</p>
  
  <pre><code>    @Before
      public void setUp() {
          WebDriverManager.chromedriver().setup();
          ChromeOptions options = new ChromeOptions();
          options.addArguments("--window-size=1920,1080");
          driver = new ChromeDriver(options);
          driver.navigate().to(baseUrl);
      }
  
      @After
      public void tearDown() {
          if (driver != null) {
              driver.quit();
          }
      }
  </code></pre>
  
  <p>In principle, this works fine. Tests are execute in parallel and in random order, as instructed in the maven pom, <code>setUp()</code> is called before each Scenario, <code>tearDown()</code> is called after each Scenario.</p>
  
  <p>However, ChromeDriver apparently runs multiple tests in one browser session, so Cookies etc. are shared between Functions and Scenarios leading to them not properly being isolated from each other which leads to further problems with cookies, sessions etc.</p>
  
  <p>How to properly isolate each test case (ChromeDriver session) when running Webdriver via Cucumber-JVM in parallel?</p>