}
}
}
private static RemoteWebDriver makeDriver() {
DesiredCapabilities dc = new DesiredCapabilities();
String browserType = TestFlag.BROWSER.getString("firefox");
if ("chrome".equals(browserType)) {
// Chrome driver is odd in that the path to Chrome is specified
// by a desiredCapability when you start a session. The other
// browser drivers will read a java system property on start.
// This applies to both remote Chrome and local Chrome.
ChromeOptions chromeOpts = new ChromeOptions();
String chromeBin = TestFlag.CHROME_BINARY.getString(null);
if (chromeBin != null) {
chromeOpts.setBinary(chromeBin);
}
String chromeArgs = TestFlag.CHROME_ARGS.getString(null);
if (chromeArgs != null) {
String[] args = chromeArgs.split(";");
chromeOpts.addArguments(args);
}
dc.setCapability(ChromeOptions.CAPABILITY, chromeOpts);
}
String url = TestFlag.WEBDRIVER_URL.getString("");
if (!"".equals(url)) {
dc.setBrowserName(browserType);
dc.setJavascriptEnabled(true);
try {
return new RemoteWebDriver(new URL(url), dc);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}