Java Code Examples for org.openqa.selenium.chrome.ChromeDriverService#createDefaultService()

The following examples show how to use org.openqa.selenium.chrome.ChromeDriverService#createDefaultService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChromeDriverHelper.java    From qaf with MIT License 7 votes vote down vote up
private synchronized void createAndStartService() {
	if ((service != null) && service.isRunning()) {
		return;
	}
	File driverFile = new File(ApplicationProperties.CHROME_DRIVER_PATH.getStringVal("./chromedriver.exe"));
	if (!driverFile.exists()) {
		logger.error("Please set webdriver.chrome.driver property properly.");
		throw new AutomationError("Driver file not exist.");
	}
	try {
		System.setProperty("webdriver.chrome.driver", driverFile.getCanonicalPath());
		service = ChromeDriverService.createDefaultService();
		service.start();
	} catch (IOException e) {
		logger.error("Unable to start Chrome driver", e);
		throw new AutomationError("Unable to start Chrome Driver Service ", e);
	}
}
 
Example 2
Source File: Browser.java    From coteafs-selenium with Apache License 2.0 5 votes vote down vote up
private static WebDriver setupChromeDriver() throws MalformedURLException {
    LOG.i("Setting up Chrome driver...");
    System.setProperty("webdriver.chrome.silentOutput", "true");
    setupDriver(chromedriver());
    final ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--dns-prefetch-disable");
    if (appSetting().isHeadlessMode()) {
        chromeOptions.addArguments("--headless");
    }
    chromeOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    final ChromeDriverService chromeService = ChromeDriverService.createDefaultService();
    return new ChromeDriver(chromeService, chromeOptions);
}
 
Example 3
Source File: StandaloneDriverFactory.java    From teasy with MIT License 5 votes vote down vote up
private WebDriver chrome(DesiredCapabilities customCaps, Platform platform) {
    DriverHolder.setDriverName(CHROME);
    WebDriverManager.chromedriver().setup();
    ChromeDriverService service = ChromeDriverService.createDefaultService();
    ChromeDriver chromeDriver = new ChromeDriver(
            service,
            new ChromeCaps(customCaps, this.alertBehaviour, this.isHeadless, platform).get()
    );
    TestParamsHolder.setChromePort(service.getUrl().getPort());
    return chromeDriver;
}
 
Example 4
Source File: ChromeDriverEx.java    From QVisual with Apache License 2.0 4 votes vote down vote up
public ChromeDriverEx(Capabilities capabilities) {
    this(ChromeDriverService.createDefaultService(), capabilities);
}
 
Example 5
Source File: UserJourneyTestIT.java    From getting-started-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() throws Exception {
  service = ChromeDriverService.createDefaultService();
  service.start();
}
 
Example 6
Source File: UserJourneyTestIT.java    From getting-started-java with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() throws Exception {
  service = ChromeDriverService.createDefaultService();
  service.start();
}
 
Example 7
Source File: UserJourneyTestIT.java    From java-docs-samples with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setupClass() throws Exception {
  service = ChromeDriverService.createDefaultService();
  service.start();
}
 
Example 8
Source File: ChromeDriver.java    From selenium with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new ChromeDriver using the {@link ChromeDriverService#createDefaultService default}
 * server configuration.
 *
 * @see #ChromeDriver(ChromeDriverService, ChromeOptions)
 */
public ChromeDriver() {
  this(ChromeDriverService.createDefaultService(), new ChromeOptions());
}
 
Example 9
Source File: ChromeDriver.java    From selenium with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new ChromeDriver instance. The {@code capabilities} will be passed to the
 * ChromeDriver service.
 *
 * @param capabilities The capabilities required from the ChromeDriver.
 * @see #ChromeDriver(ChromeDriverService, Capabilities)
 * @deprecated Use {@link ChromeDriver(ChromeOptions)} instead.
 */
@Deprecated
public ChromeDriver(Capabilities capabilities) {
  this(ChromeDriverService.createDefaultService(), capabilities);
}