Search in sources :

Example 1 with Builder

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();
}
Also used : Proxy(org.openqa.selenium.Proxy) Builder(org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder) File(java.io.File)

Aggregations

File (java.io.File)1 Proxy (org.openqa.selenium.Proxy)1 Builder (org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder)1