use of org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder in project fess by codelibs.
the class WebDriverGenerator method createDriverService.
@SuppressWarnings("deprecation")
protected PhantomJSDriverService createDriverService(final Capabilities desiredCapabilities) {
// Look for Proxy configuration within the Capabilities
Proxy proxy = null;
if (desiredCapabilities != null) {
proxy = Proxies.extractProxy(desiredCapabilities);
}
// Find PhantomJS executable
String phantomjspath = null;
if (desiredCapabilities != null && desiredCapabilities.getCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY) != null) {
phantomjspath = (String) desiredCapabilities.getCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY);
} else {
phantomjspath = CommandLine.find(PHANTOMJS_DEFAULT_EXECUTABLE);
phantomjspath = System.getProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjspath);
}
final File phantomjsfile = new File(phantomjspath);
// Build & return service
return //
new Builder().usingPhantomJSExecutable(phantomjsfile).usingAnyFreePort().withProxy(//
proxy).withLogFile(//
new File(ComponentUtil.getSystemHelper().getLogFilePath(), "phantomjs.log")).usingCommandLineArguments(//
findCLIArgumentsFromCaps(desiredCapabilities, PhantomJSDriverService.PHANTOMJS_CLI_ARGS)).build();
}