Created
May 16, 2011 08:43
-
-
Save fwielstra/974107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WebDriverSupplier { | |
private static final Supplier<WebDriver> FIREFOX_SUPPLIER = new Supplier<WebDriver>() { | |
private WebDriver firefoxDriver; | |
@Override | |
public WebDriver get() { | |
if (firefoxDriver == null) { | |
firefoxDriver = new FirefoxDriver(); | |
} | |
return firefoxDriver; | |
} | |
}; | |
private static final Supplier<WebDriver> INTERNET_EXPLORER_SUPPLIER = new Supplier<WebDriver>() { | |
private WebDriver ieDriver; | |
@Override | |
public WebDriver get() { | |
if (ieDriver == null) { | |
ieDriver = new InternetExplorerDriver(); | |
} | |
return ieDriver; | |
} | |
}; | |
private static final List<Supplier<WebDriver>> suppliers = new ArrayList<Supplier<WebDriver>>(); | |
static { | |
if (System.getProperty("os.name").startsWith("Windows")) { | |
suppliers.add(INTERNET_EXPLORER_SUPPLIER); | |
} | |
suppliers.add(FIREFOX_SUPPLIER); | |
} | |
public static List<Supplier<WebDriver>> getWebDrivers() { | |
return suppliers; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment