View Javadoc

1   package com.atlassian.webdriver.browsers;
2   
3   import com.atlassian.webdriver.AtlassianWebDriver;
4   import com.atlassian.webdriver.LifecycleAwareWebDriverGrid;
5   import com.google.common.base.Supplier;
6   import org.slf4j.LoggerFactory;
7   
8   /**
9    * Client that supports automatically installing the appropriate browser for the environment
10   *
11   */
12  public enum WebDriverBrowserAutoInstall
13  {
14      INSTANCE;
15  
16      public AtlassianWebDriver getDriver()
17      {
18          try {
19              return LifecycleAwareWebDriverGrid.getDriver();
20          } catch (RuntimeException error) {
21              LoggerFactory.getLogger(WebDriverBrowserAutoInstall.class).error("Unable to setup browser", error);
22              throw error;
23          }
24      }
25  
26      public static Supplier<AtlassianWebDriver> driverSupplier()
27      {
28          return new Supplier<AtlassianWebDriver>()
29          {
30              @Override
31              public AtlassianWebDriver get()
32              {
33                  return INSTANCE.getDriver();
34              }
35          };
36      }
37  }