title: WebDriver: How to Convert MarionetteDriver to ThreadLocal<WebDriver> for usage in Parallel Test in TestNG
body: <p>is there any ways to achieve type casting of local instance of <code>WebDriver</code> through <code>ThreadLocal&lt;WebDriver&gt;</code>  to <code>MarionetteDriver</code>??? My code goes like this</p>
  
  <pre><code>    public class Base_Class 
     {
      protected ThreadLocal&lt;WebDriver&gt; Driver = null;
      @BeforeMethod
      @Parameters("BrowserName")
      public void setUp(@Optional("Firefox") String BrowserName) throws MalformedURLException
      {
  
          Driver = new ThreadLocal&lt;WebDriver&gt;();
          if(BrowserName.equalsIgnoreCase("FireFox"))
          { 
  
              System.setProperty("webdriver.gecko.driver", "..//BrowserDrivers//wires");
              DesiredCapabilities capabilities = DesiredCapabilities.firefox();
              capabilities.setCapability("marionette", true);
               Driver = new &lt;ThreadLocal&lt;WebDriver&gt;&gt; MarionetteDriver(capabilities);
  
  
         }
          else  if(BrowserName.equalsIgnoreCase("Chrome"))
          {
              System.setProperty("webdriver.chrome.driver", "..//BrowserDrivers//chromedriver");
              Driver = new &lt;ThreadLocal&lt;WebDriver&gt;&gt;ChromeDriver();
          }
      }
  
      public WebDriver getDriver()
      {
          return Driver.get();
      }
  
      @AfterMethod
      public void closeBrowser()
      {
          getDriver().quit();
  
      }
      }
  </code></pre>
  
  <p>And all the test case are defined in separate classes which extends this above Base_Class. </p>
  
  <blockquote>
    <p>Getting Error @  <code>Driver = new &lt;ThreadLocal&lt;WebDriver&gt;&gt; MarionetteDriver(capabilities); and Driver = new &lt;ThreadLocal&lt;WebDriver&gt;&gt;ChromeDriver(); lines as Type mismatch: cannot convert from MarionetteDriver to ThreadLocal&lt;WebDriver&gt;</code></p>
  </blockquote>
  
  <p>I am using <code>Chrome Version 52.0.2743.116 (64-bit)</code> and <code>FireFox Version 48.0</code> version browsers on <code>Ubuntu 14.04</code> Os and <code>Selenium version selenium-server-standalone-2.53.0</code></p>
  
  <p>Wanted to achieve parallel test execution through <code>testng.xml</code> file..</p>
  
  <p>any help would be highly appreciated..</p>