synchronized LocalHub getLocalServerComponent() { if (instance == null) { instance = new LocalHub(); instance.setHost(new NetworkUtils().getIpOfLoopBackIp4()); // Choose a random port for local hub. int hubPort = PortProber.findFreePort(); instance.setPort(hubPort); // Set ConfigProperty.SELENIUM_PORT so that the local nodes can register to it. Config.setConfigProperty(ConfigProperty.SELENIUM_PORT, Integer.toString(hubPort)); LauncherOptions launcherOptions = new LauncherConfiguration() .setFileDownloadCheckTimeStampOnInvocation(false).setFileDownloadCleanupOnInvocation(false); instance.setLauncher(new ThreadedLauncher(new String[] { "-role", "hub", "-port", String.valueOf(instance.getPort()), "-host", instance.getHost() }, launcherOptions)); } return instance; }
synchronized LocalNode getLocalServerComponent() { if (instance == null) { instance = new LocalNode(); instance.setHost(new NetworkUtils().getIpOfLoopBackIp4()); instance.setPort(PortProber.findFreePort()); String hubPort = Config.getConfigProperty(ConfigProperty.SELENIUM_PORT); String hub = String.format("http://%s:%s/grid/register", instance.getHost(), hubPort); setLegacyFFBootupIfRequested(); LauncherOptions launcherOptions = new LauncherConfiguration() .setFileDownloadCheckTimeStampOnInvocation(false).setFileDownloadCleanupOnInvocation(false); List<String> downloadList = determineListOfDownloadsToProcess(); instance.setLauncher(new ThreadedLauncher(new String[] { "-role", "node", "-port", String.valueOf(instance.getPort()), "-proxy", DefaultRemoteProxy.class.getName(), "-host", instance.getHost(), "-hub", hub }, launcherOptions, downloadList)); } return instance; }
synchronized LocalIOSNode getLocalServerComponent() { if (instance == null) { instance = new LocalIOSNode(); instance.setHost(new NetworkUtils().getIpOfLoopBackIp4()); instance.setPort(PortProber.findFreePort()); String hubPort = Config.getConfigProperty(ConfigProperty.SELENIUM_PORT); String hub = String.format("http://%s:%s/grid/register", instance.getHost(), hubPort); String[] folder = new String[] { "", "" }; String autFolder = Config.getConfigProperty(ConfigProperty.MOBILE_APP_FOLDER); if (StringUtils.isNotEmpty(autFolder)) { folder = new String[] { "-folder", autFolder }; } ProcessLauncherOptions processOptions = new ProcessLauncherConfiguration().setContinuouslyRestart(false) .setIncludeJarsInPresentWorkingDir(false).setIncludeParentProcessClassPath(false) .setIncludeJavaSystemProperties(false).setFileDownloadCheckTimeStampOnInvocation(false) .setFileDownloadCleanupOnInvocation(false); instance.setLauncher(new IOSDriverJarSpawner(new String[] { "-port", String.valueOf(instance.getPort()), "-host", instance.getHost(), "-hub", hub, folder[0], folder[1], "-sessionTimeout", Config.getConfigProperty(ConfigProperty.MOBILE_DRIVER_SESSION_TIMEOUT) }, processOptions)); } return instance; }
instance = new LocalSelendroidNode(); instance.setHost(new NetworkUtils().getIpOfLoopBackIp4()); instance.setPort(PortProber.findFreePort());