*/
@Override
public ChromeDriver createInstance(WebDriverConfiguration configuration) {
// set capabilities
DesiredCapabilities capabilities = new DesiredCapabilities(configuration.getCapabilities());
String driverBinary = configuration.getChromeDriverBinary();
String binary = (String) capabilities.getCapability("chrome.binary");
String chromeSwitches = (String) capabilities.getCapability("chrome.switches");
if (Validate.empty(driverBinary)) {
driverBinary = SecurityActions.getProperty(CHROME_DRIVER_BINARY_KEY);
}
// driver binary configuration
// this is setting system property
if (Validate.nonEmpty(driverBinary)) {
Validate.isExecutable(driverBinary, "Chrome driver binary must point to an executable file, " + driverBinary);
SecurityActions.setProperty(CHROME_DRIVER_BINARY_KEY, driverBinary);
}
// verify binary capabilities
if (Validate.nonEmpty(binary)) {
Validate.isExecutable(binary, "Chrome binary must point to an executable file, " + binary);
}
// convert chrome switches to an array of strings
if (Validate.nonEmpty(chromeSwitches)) {
capabilities.setCapability("chrome.switches", getChromeSwitches(chromeSwitches));
}
// FIXME this call will not be supported for a long time
// Chrome will be using ChromeOptions object
return SecurityActions.newInstance(configuration.getImplementationClass(), new Class<?>[] { Capabilities.class },