title: Inject WebDrivers in TestNG @before test with @guice
body: <p>I am new with configure selenium. Looked for passing drivers find this solution <a href="https://stackoverflow.com/a/35101914/7104440">https://stackoverflow.com/a/35101914/7104440</a> I wonder is possible to @inject many drivers from browsers in this way. Is possible to bind different drivers? I got error with this code:</p>
  
  <pre><code>encom.google.inject.CreationException: Unable to create injector, see the following errors:
  </code></pre>
  
  <p>1) Binding to null instances is not allowed. Use toProvider(Providers.of(null)) if this is your intended behaviour.
    at assecobs.driver.DriverModule.configure(DriverModule.java:31)</p>
  
  <p>2) A binding to org.openqa.selenium.WebDriver was already configured at assecobs.driver.DriverModule.configure(DriverModule.java:31).
    at assecobs.driver.DriverModule.configure(DriverModule.java:31)</p>
  
  <p>DriverModule.class</p>
  
  <pre><code>private DriverSetup driverSetup = new DriverSetup();
  
  @BeforeSuite
  @Override
  public void configure(Binder binder) {
  
      for (BrowserNames browserName : BrowserNames.values()) {
          System.out.println(" bind " + browserName.toString());
          WebDriver driver = driverSetup.initDriver(browserName.toString());
          binder.bind(WebDriver.class).toInstance(driver);
      }
  }
  }
  </code></pre>
  
  <p>DriverSetup.class</p>
  
  <pre><code> @SneakyThrows
  public WebDriver initDriver(String browser) {
      if (browser.equalsIgnoreCase("chrome")) {
          capabilities = chromeCapabilities();
          driver = initChromeDriver(capabilities);
  
      } else if (browser.equalsIgnoreCase("firefox")) {
          capabilities = firefoxCapabilities();
          driver = initFirefoxDriver(capabilities);
  
      } else if (browser.equalsIgnoreCase("opera")) {
          capabilities = operaCapabilities();
          driver = initOperaDriver(capabilities);
  
      } else {
              capabilities = firefoxCapabilities();
              return driver = initFirefoxDriver(capabilities);
          }
  
          return driver;
      }
  </code></pre>
  
  <p>ClientTest.class</p>
  
  <pre><code>@Guice(modules = {DriverModule.class})
  public class ClientTest extends DriverSetup {
  
  @Inject
  WebDriver driver;
  </code></pre>