Skip to content

Instantly share code, notes, and snippets.

@fwielstra
Created May 16, 2011 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fwielstra/974129 to your computer and use it in GitHub Desktop.
Save fwielstra/974129 to your computer and use it in GitHub Desktop.
A WebDriverSupplier
public class WebDriverSupplier {
private static final Supplier<WebDriver> FIREFOX_SUPPLIER = new Supplier<WebDriver>() {
@Override
public WebDriver get() {
return new FirefoxDriver();
}
};
private static final Supplier<WebDriver> INTERNET_EXPLORER_SUPPLIER = new Supplier<WebDriver>() {
private WebDriver ieDriver;
@Override
public WebDriver get() {
return new InternetExplorerDriver();
}
};
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