throw new RuntimeException("Unable to start Selenium Server", e);
}
}
private RemoteControlConfiguration configure(SeleniumServerConfiguration configuration) {
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setAvoidProxy(configuration.isAvoidProxy());
rcc.setBrowserSideLogEnabled(configuration.isBrowserSideLog());
rcc.setDebugMode(configuration.isDebug());
rcc.setDontTouchLogging(configuration.isDontTouchLogging());
SecurityActions.setProperty("selenium.loglevel", configuration.isDebug() ? "DEBUG" : "INFO");
rcc.setEnsureCleanSession(configuration.isEnsureCleanSession());
// set firefox profile
String ffProfile = configuration.getFirefoxProfileTemplate();
if (Validate.isNotNullOrEmpty(ffProfile)) {
Validate.isValidFile(ffProfile, "Firefox profile must point to a readable directory: " + ffProfile);
rcc.setFirefoxProfileTemplate(new File(ffProfile));
}
// force browser type
String forcedMode = configuration.getForcedBrowserMode();
if (Validate.isNotNullOrEmpty(forcedMode)) {
rcc.setForcedBrowserMode(forcedMode);
}
rcc.setHonorSystemProxy(configuration.isHonorSystemProxy());
// log file
String logFile = configuration.getLogFile();
if (Validate.isNotNullOrEmpty(logFile)) {
Validate.isInReadableDirectory(logFile, "Log file cannot be created: " + logFile);
rcc.setLogOutFile(new File(logFile));
}
rcc.setPort(configuration.getPort());
// set profile location
String profiles = configuration.getProfilesLocation();
if (Validate.isNotNullOrEmpty(profiles)) {
Validate.isValidFile(profiles, "Profiles location must point to a readable directory: " + profiles);
rcc.setProfilesLocation(new File(profiles));
}
rcc.setProxyInjectionModeArg(configuration.isProxyInjectionMode());
rcc.setReuseBrowserSessions(configuration.isBrowserSessionReuse());
rcc.setRetryTimeoutInSeconds(configuration.getRetryTimeoutInSeconds());
rcc.setSingleWindow(configuration.isSingleWindow());
rcc.setTimeoutInSeconds(configuration.getTimeoutInSeconds());
rcc.setTrustAllSSLCertificates(configuration.isTrustAllSSLCertificates());
String userExtensions = configuration.getUserExtensions();
if (Validate.isNotNullOrEmpty(userExtensions)) {
Validate.isValidFile(userExtensions, "User extensions must point to a valid file");
rcc.setUserExtensions(new File(userExtensions));
}
return rcc;
}