Private used static method for creation of a RemoteWebDriver. Taking care of the default
Capabilities and using the HttpCommandExecutor.

@param hubUrl the url of the hub to use.
@return the RemoteWebDriver instance.
184233
private static RemoteWebDriver buildRemoteWebDriver(String hubUrl) {
		DesiredCapabilities capabilities = new DesiredCapabilities();
		capabilities.setPlatform(Platform.ANY);
		URL url;
		try {
			url = new URL(hubUrl);
		} catch (MalformedURLException e) {
			LOGGER.error("The given hub url of the remote server is malformed can not continue!",
					e);
			return null;
		}
		HttpCommandExecutor executor = null;
		try {
			executor = new HttpCommandExecutor(url);
		} catch (Exception e) {
			// TODO Stefan; refactor this catch, this will definitely result in
			// NullPointers, why
			// not throw RuntimeException direct?
			LOGGER.error(
					"Received unknown exception while creating the "
							+ "HttpCommandExecutor, can not continue!",
					e);
			return null;
		}
		return new RemoteWebDriver(executor, capabilities);
	}
177800
public WebDriverExecutor getWebDriverExecutor() {
        if (webDriverExecutor == null) {
            if (webDriverProvider == null) {
                webDriverExecutor = new WebDriverExecutor();
            } else {
                webDriverExecutor = new WebDriverExecutor(webDriverProvider);
            }
        }
        return webDriverExecutor;
    }
357911
private RemoteWebDriver createRemoteWebDriver(String browserType, String serverAddress) {
        try {
            switch (browserType) {
                case BrowserType.FIREFOX:
                    DesiredCapabilities defaultsFF = DesiredCapabilities.firefox();
                    defaultsFF.setCapability(FirefoxDriver.PROFILE, getEndpointConfiguration().getFirefoxProfile());
                    return new RemoteWebDriver(new URL(serverAddress), defaultsFF);
                case BrowserType.IE:
                    DesiredCapabilities defaultsIE = DesiredCapabilities.internetExplorer();
                    defaultsIE.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
                    return new RemoteWebDriver(new URL(serverAddress), defaultsIE);
                case BrowserType.CHROME:
                    DesiredCapabilities defaultsChrome = DesiredCapabilities.chrome();
                    defaultsChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
                    return new RemoteWebDriver(new URL(serverAddress), defaultsChrome);
                case BrowserType.GOOGLECHROME:
                    DesiredCapabilities defaultsGoogleChrome = DesiredCapabilities.chrome();
                    defaultsGoogleChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
                    return new RemoteWebDriver(new URL(serverAddress), defaultsGoogleChrome);
                default:
                    throw new CitrusRuntimeException("Unsupported remote browser type: " + browserType);
            }
        } catch (MalformedURLException e) {
            throw new CitrusRuntimeException("Failed to access remote server", e);
        }
    }
1038597
private KNXNetworkLink createLink() throws KNXException
	{
		final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
		if (options.containsKey("serial")) {
			// create FT1.2 network link
			final String p = (String) options.get("serial");
			try {
				return new KNXNetworkLinkFT12(Integer.parseInt(p), medium);
			}
			catch (final NumberFormatException e) {
				return new KNXNetworkLinkFT12(p, medium);
			}
		}
		// create local and remote socket address for network link
		final InetSocketAddress local = createLocalSocket((InetAddress)
			options.get("localhost"), (Integer) options.get("localport"));
		final InetSocketAddress host = new InetSocketAddress((InetAddress)
			options.get("host"), ((Integer) options.get("port")).intValue());
		final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER
			: KNXNetworkLinkIP.TUNNEL;
		return new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"),
			medium);
	}
704305
public static void createWindowsDesktopUrlLink(final String baseUrl, final String url, final File workingDir, final Integer showCommand,
            final Integer iconIndex, final File iconFile, final Integer hotKey, final String linkFilenameWithoutExtension,
            final boolean overwrite, final Date modified) throws IOException {
        // CHECKSTYLE:ON

        checkNotNull("baseUrl", baseUrl);
        checkNotEmpty("baseUrl", baseUrl);
        checkNotNull("url", url);
        checkNotEmpty("url", url);
        checkNotNull("linkFilenameWithoutExtension", linkFilenameWithoutExtension);
        checkNotEmpty("linkFilenameWithoutExtension", linkFilenameWithoutExtension);

        final File userHomeDir = new File(System.getProperty(USER_HOME_KEY));
        final File desktopDir = new File(userHomeDir, "Desktop");
        final File linkFile = new File(desktopDir, linkFilenameWithoutExtension + ".url");
        if (linkFile.exists() && !overwrite) {
            // Do nothing
            return;
        }
        final String content = createWindowsDesktopUrlLinkContent(baseUrl, url, workingDir, showCommand, iconIndex, iconFile, hotKey,
                modified);
        try (final Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(linkFile), "Cp1252"))) {
            writer.write(content);
        }

    }
1060595
@Override
    public WebDriverBrowser<?> create(Object obj) {
        try {
            WebDriverProperties webDriverProperties;
            if (obj instanceof Scriptable && "String".equals(((Scriptable) obj).getClassName())) {
                obj = obj.toString();
            }

            if (obj instanceof String) {
                webDriverProperties = new WebDriverProperties();
                webDriverProperties.getDesiredCapabilities().put("browserName", obj);
            } else if (obj instanceof Scriptable) {
                final Scriptable scriptable = (Scriptable) obj;
                String json = engine.runWithContext(engine.new RhinoCallable<String, RuntimeException>() {
                    @Override
                    protected String doCall(Context cx, Scriptable scope) throws RuntimeException {
                        return (String) cx.evaluateString(scriptable, "JSON.stringify(this)", "<expression>", 1, null);
                    }
                });
                webDriverProperties = mapper.readValue(json, WebDriverProperties.class);
            } else {
                throw new IllegalArgumentException("Only strings or maps are accepted");
            }
            WebDriver wd = webDriverFactory.create(webDriverProperties);
            WebModule webModule = combine(defaultModule(wd), WebModules.debugModule(), RhinoWebModules.rhinoModule());
            return new WebDriverBrowser<DefaultWebElements>(wd, DefaultWebElements.class, webModule);
        } catch (IOException e) {
            throw Throwables.propagate(e);
        }
    }
928525
public static Element getContentElementByUrl(String url) throws Exception {
//        HttpRequest request = new HttpRequest(url);
        String html = okHttpRequester.getResponse(url).html();
        return getContentElementByHtml(html, url);
    }
736640
public BoxWebLink.Info createWebLink(URL linkURL, String description) {
        return this.createWebLink(null, linkURL, description);
    }
561194
public static URLConnection open(URL url) throws IOException {
        final ProxyConfiguration p = get();
        
        URLConnection con;
        if(p==null) {
            con = url.openConnection();
        } else {
            Proxy proxy = p.createProxy(url.getHost());
            con = url.openConnection(proxy);
            if(p.getUserName()!=null) {
                // Add an authenticator which provides the credentials for proxy authentication
                Authenticator.setDefault(p.authenticator);
                p.jenkins48775workaround(proxy, url);
            }
        }
        
        if(DEFAULT_CONNECT_TIMEOUT_MILLIS > 0) {
            con.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS);
        }
        
        if (JenkinsJVM.isJenkinsJVM()) { // this code may run on a slave
            decorate(con);
        }

        return con;
    }
390486
public static WebDriver getDriverWithProxy(final String proxyURL,
			final String port, final WebDriver driver) {
		org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
		proxy.setHttpProxy(proxyURL + ":" + port)
				.setFtpProxy(proxyURL + ":" + port)
				.setSslProxy(proxyURL + ":" + port);

		DesiredCapabilities cap = new DesiredCapabilities();
		cap.setCapability(CapabilityType.PROXY, proxy);

		try {
			Constructor<?> c = driver.getClass().getConstructor(
					Capabilities.class);
			return (WebDriver) c.newInstance(cap);
		} catch (Exception e) {
			LOG.error(
					"Exception while creating a driver with the specified proxy",
					e);
		}
		return driver;
	}
771534
def create_driver(self):
        
        driver_type = self.config.get('Driver', 'type')
        try:
            if self.config.getboolean_optional('Server', 'enabled'):
                self.logger.info("Creating remote driver (type = %s)", driver_type)
                driver = self._create_remote_driver()
            else:
                self.logger.info("Creating local driver (type = %s)", driver_type)
                driver = self._create_local_driver()
        except Exception as exc:
            error_message = get_error_message_from_exception(exc)
            self.logger.error("%s driver can not be launched: %s", driver_type.capitalize(), error_message)
            raise

        return driver
1028407
public static WebDriver createDriver(String browserType, String url, String size) {
        if (browserType == null) { 
            browserType = GalenConfig.getConfig().getDefaultBrowser();
        }
        
        SeleniumBrowser browser = (SeleniumBrowser) new SeleniumBrowserFactory(browserType).openBrowser();
        
        if (url != null && !url.trim().isEmpty()) {
            browser.load(url);    
        }
        
        if (size != null && !size.trim().isEmpty()) {
            browser.changeWindowSize(GalenUtils.readSize(size));
        }
        
        return browser.getDriver();
    }
1332105
public static Driver loadDriver(final URL jarUrl) {
        final URLClassLoader driverCl = URLClassLoader.
            newInstance(new URL[] { jarUrl }, null);

        final Iterator<Driver> iter = ServiceLoader.
            load(Driver.class, driverCl).iterator();

        if (!iter.hasNext()) {
            System.err.println("No JDBC driver found: " + jarUrl);
            return null;
        } // end of if

        // ---

        Driver d;
        while (iter.hasNext()) {
            d = iter.next();

            if (driverCl.equals(d.getClass().getClassLoader())) {
                return d; // Ignore driver at system classloader
                // e.g. sun.jdbc.odbc.JdbcOdbcDriver
            } // end of if
        } // end of while

        return null;
    }
210868
function SeleniumWebdriverBrowser(id, baseBrowserDecorator, args, logger) {
  baseBrowserDecorator(this);

  var self = this;
  var captured = false;
  var log = logger.create('launcher.selenium-webdriver');
  var browserName = args.browserName;
  var killingPromise;

  self.id = id;
  self.setName(browserName);

  log.info('SeleniumWebdriverBrowser (kid:'+id+') created');

  self._start = function(url){
    log.info('starting '+self.name);
    var driver = args.getDriver();
    self.driver_ = driver;

    self.getSession_(function(session){
      // TODO: caps_ might be a defer as well
      self.setName(session.caps_.caps_);
    });

    log.info('sending driver to url '+url);
    driver.get(url);
  };

  self.kill = function(){

    // Already killed, or being killed.
    if (killingPromise) {
      return killingPromise;
    }

    var deferred = q.defer();

    killingPromise = deferred.promise;

    self.getSession_(function(session){
      log.info('requested to kill, session id is '+(session && session.id_));

      if (!session) {
        return deferred.reject();
      }

      if(session.id_){
        self.driver_ && self.driver_.quit();
        deferred.resolve();
      }
    });

    return killingPromise;

  };

  self.forceKill = function() {
    self.kill();
    return killingPromise;
  };

}
662188
public String HLSPlayURL(String domain, String hub, String streamKey) {
        return String.format("http://%s/%s/%s.m3u8", domain, hub, streamKey);
    }
722004
public WebDriver setupDriver() throws InvalidBrowserException {
        WebDriver driver;
        // check the browser
        switch (browser.getName()) {
            case HTMLUNIT:
                System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog", "fatal");
                java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF);
                java.util.logging.Logger.getLogger("org.apache.http").setLevel(Level.OFF);
                driver = new HtmlUnitDriver(desiredCapabilities);
                break;
            case FIREFOX:
                WebDriverManager.firefoxdriver().forceCache().setup();
                FirefoxOptions firefoxOptions = new FirefoxOptions(desiredCapabilities);
                firefoxOptions.addArguments(getBrowserOptions());
                if (Property.runHeadless()) {
                    firefoxOptions.setHeadless(true);
                }
                driver = new FirefoxDriver(firefoxOptions);
                break;
            case CHROME:
                WebDriverManager.chromedriver().forceCache().setup();
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions = chromeOptions.merge(desiredCapabilities);
                chromeOptions.addArguments(getBrowserOptions());
                if (Property.runHeadless()) {
                    chromeOptions.setHeadless(true);
                }
                driver = new ChromeDriver(chromeOptions);
                break;
            case INTERNETEXPLORER:
                WebDriverManager.iedriver().forceCache().setup();
                InternetExplorerOptions internetExplorerOptions = new InternetExplorerOptions(desiredCapabilities);
                driver = new InternetExplorerDriver(internetExplorerOptions);
                break;
            case EDGE:
                WebDriverManager.edgedriver().forceCache().setup();
                EdgeOptions edgeOptions = new EdgeOptions();
                edgeOptions = edgeOptions.merge(desiredCapabilities);
                driver = new EdgeDriver(edgeOptions);
                break;
            case SAFARI:
                SafariOptions safariOptions = new SafariOptions(desiredCapabilities);
                driver = new SafariDriver(safariOptions);
                break;
            case OPERA:
                WebDriverManager.operadriver().forceCache().setup();
                OperaOptions operaOptions = new OperaOptions();
                operaOptions = operaOptions.merge(desiredCapabilities);
                driver = new OperaDriver(operaOptions);
                break;
            case PHANTOMJS:
                WebDriverManager.phantomjs().forceCache().setup();
                driver = new PhantomJSDriver(desiredCapabilities);
                break;
            // if the browser is not listed, throw an error
            default:
                throw new InvalidBrowserException(
                        "The selected browser " + browser.getName() + " is not an applicable choice");
        }
        return driver;
    }
749496
public HubConnection build() {
        return new HubConnection(url, transport, skipNegotiate, httpClient, accessTokenProvider, handshakeResponseTimeout, headers);
    }