All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jp.vmi.selenium.webdriver.CustomChromeDriverService Maven / Gradle / Ivy

package jp.vmi.selenium.webdriver;

import java.io.File;
import java.io.IOException;
import java.util.Map;

import org.openqa.selenium.chrome.ChromeDriverService;

/**
 * Customized ChromeDriverService.
 */
public class CustomChromeDriverService extends ChromeDriverService {

    // Don't use this.
    private CustomChromeDriverService() throws IOException {
        super(null, 0, null, null);
        throw new UnsupportedOperationException("Don't use this.");
    }

    /**
     * Configures and returns a new {@link ChromeDriverService}.
     *
     * @param environment environment variables.
     * @return A new ChromeDriverService.
     */
    public static ChromeDriverService createService(Map environment) {
        File exe = findExecutable("chromedriver", CHROME_DRIVER_EXE_PROPERTY,
            "http://code.google.com/p/selenium/wiki/ChromeDriver",
            "http://chromedriver.storage.googleapis.com/index.html");
        return new Builder().usingDriverExecutable(exe).usingAnyFreePort().withEnvironment(environment).build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy