Source:
public RemoteWebDriver createInstance(WebDriverConfiguration configuration) { URL remoteAddress = configuration.getRemoteAddress(); if (Validate.empty(remoteAddress)) { remoteAddress = WebDriverConfiguration.DEFAULT_REMOTE_URL; log.log(Level.INFO, "Property \"remoteAddress\" was not specified, using default value of {0}", WebDriverConfiguration.DEFAULT_REMOTE_URL); } Validate.isValidUrl(remoteAddress, "Remote address must be a valid url, " + remoteAddress); String browser = configuration.getBrowser(); if (Validate.empty(browser)) { configuration.setBrowser(WebDriverConfiguration.DEFAULT_BROWSER_CAPABILITIES); log.log(Level.INFO, "Property \"browser\" was not specified, using default value of {0}", WebDriverConfiguration.DEFAULT_BROWSER_CAPABILITIES); } Validate.isEmpty(configuration.getBrowser(), "The browser is not set."); DesiredCapabilities desiredCapabilities = new DesiredCapabilities(getCapabilities(configuration, true)); if (browser.equals("chromeHeadless") || browser.equals("chromeheadless")) { getChromeHeadlessCapabilities(configuration, desiredCapabilities); } if (!UrlUtils.isReachable(remoteAddress)) { if (UrlUtils.isLocalhost(remoteAddress)) { log.info("The Selenium server is not running on: " + remoteAddress + " and as the address seems to be a localhost address, Drone will start the Selenium Server automatically."); try { downloadAndStartSeleniumServer(configuration, browser, remoteAddress); } catch (Exception e) { throw new IllegalStateException( "Something bad happened when Drone was trying to download and extract Selenium Server binary. " + "For more information see the cause.", e); } } else { log.warning("The URL: " + remoteAddress + " doesn't seem to be reachable. If there is no Selenium Server running, start it before the tests are run."); } } RemoteWebDriver driver = null; if (configuration.isRemoteReusable()) { driver = createReusableDriver(remoteAddress, desiredCapabilities); } else { driver = createRemoteDriver(remoteAddress, desiredCapabilities); } ((DesiredCapabilities) driver.getCapabilities()).setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver); if (!configuration.isReuseCookies()) { driver.manage().deleteAllCookies(); } return driver; }

Target:
public RemoteWebDriver createInstance(WebDriverConfiguration configuration) { URL remoteAddress = configuration.getRemoteAddress(); if (Validate.empty(remoteAddress)) { remoteAddress = WebDriverConfiguration.DEFAULT_REMOTE_URL; log.log(Level.INFO, "Property \"remoteAddress\" was not specified, using default value of {0}", WebDriverConfiguration.DEFAULT_REMOTE_URL); } Validate.isValidUrl(remoteAddress, "Remote address must be a valid url, " + remoteAddress); String browser = configuration.getBrowser().toLowerCase(); if (Validate.empty(browser)) { configuration.setBrowser(WebDriverConfiguration.DEFAULT_BROWSER_CAPABILITIES); log.log(Level.INFO, "Property \"browser\" was not specified, using default value of {0}", WebDriverConfiguration.DEFAULT_BROWSER_CAPABILITIES); } Validate.isEmpty(configuration.getBrowser(), "The browser is not set."); DesiredCapabilities desiredCapabilities = new DesiredCapabilities(getCapabilities(configuration, true)); if (browser.equals("chrome") || browser.equals("chromeheadless")) { new ChromeDriverFactory().setChromeOptions(configuration, desiredCapabilities); } if (!UrlUtils.isReachable(remoteAddress)) { if (UrlUtils.isLocalhost(remoteAddress)) { log.info("The Selenium server is not running on: " + remoteAddress + " and as the address seems to be a localhost address, Drone will start the Selenium Server automatically."); try { downloadAndStartSeleniumServer(configuration, browser, remoteAddress); } catch (Exception e) { throw new IllegalStateException( "Something bad happened when Drone was trying to download and extract Selenium Server binary. " + "For more information see the cause.", e); } } else { log.warning("The URL: " + remoteAddress + " doesn't seem to be reachable. If there is no Selenium Server running, start it before the tests are run."); } } RemoteWebDriver driver = null; if (configuration.isRemoteReusable()) { driver = createReusableDriver(remoteAddress, desiredCapabilities); } else { driver = createRemoteDriver(remoteAddress, desiredCapabilities); } ((DesiredCapabilities) driver.getCapabilities()).setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver); if (!configuration.isReuseCookies()) { driver.manage().deleteAllCookies(); } return driver; }