public void setFtpProxy(String proxyHost) { if (!StringUtils.equalsIgnoreCase(proxyHost, "none")) { proxy = new Proxy(); proxy.setFtpProxy(proxyHost); capabilities.setCapability(CapabilityType.PROXY, proxy); } }
protected Proxy setupProxy() { ProxyPool.setupBrowserMobProxy(); SystemProxy.setupProxy(); String proxyHost = Configuration.get(Parameter.PROXY_HOST); String proxyPort = Configuration.get(Parameter.PROXY_PORT); List<String> protocols = Arrays.asList(Configuration.get(Parameter.PROXY_PROTOCOLS).split("[\\s,]+")); if (proxyHost != null && !proxyHost.isEmpty() && proxyPort != null && !proxyPort.isEmpty()) { org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy(); String proxyAddress = String.format("%s:%s", proxyHost, proxyPort); if (protocols.contains("http")) { LOGGER.info(String.format("Http proxy will be set: %s:%s", proxyHost, proxyPort)); proxy.setHttpProxy(proxyAddress); } if (protocols.contains("https")) { LOGGER.info(String.format("Https proxy will be set: %s:%s", proxyHost, proxyPort)); proxy.setSslProxy(proxyAddress); } if (protocols.contains("ftp")) { LOGGER.info(String.format("FTP proxy will be set: %s:%s", proxyHost, proxyPort)); proxy.setFtpProxy(proxyAddress); } if (protocols.contains("socks")) { LOGGER.info(String.format("Socks proxy will be set: %s:%s", proxyHost, proxyPort)); proxy.setSocksProxy(proxyAddress); } return proxy; } return null; }
public void setProxy(String proxyHost) { if (!StringUtils.equalsIgnoreCase(proxyHost, "none")) { proxy = new Proxy(); proxy.setFtpProxy(proxyHost) .setHttpProxy(proxyHost) .setSslProxy(proxyHost); capabilities.setCapability(CapabilityType.PROXY, proxy); } }
setFtpProxy((String) raw.get("ftpProxy"));
/** * @return - A {@link Proxy} object that represents the Proxy server to be used. */ public static Proxy createProxyObject() { Proxy proxy = new Proxy(); String proxyHost = String.format("%s:%s", getProperty(ConfigProperty.SELENIUM_PROXY_HOST), getProperty(ConfigProperty.SELENIUM_PROXY_PORT)); proxy.setHttpProxy(proxyHost); proxy.setFtpProxy(proxyHost); proxy.setSslProxy(proxyHost); return proxy; }
private void setNetworkCapabilities(final DesiredCapabilities capabilities) { final String proxyHost = configuration.getNetworkProxyHost(); if (StringUtils.isNotEmpty(proxyHost)) { final int proxyPort = configuration.getNetworkProxyPort(); final String proxyHostAndPort = proxyHost + ":" + proxyPort; final org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy(); proxy.setHttpProxy(proxyHostAndPort).setFtpProxy(proxyHostAndPort).setSslProxy(proxyHostAndPort); capabilities.setCapability(CapabilityType.PROXY, proxy); LOG.info("Proxy set to {}", proxyHostAndPort); } }
private static Proxy createManualProxy(String proxyProperty) { String proxyString = getProxyURL(proxyProperty); logger.debug("All protocols to use proxy address: {}", proxyString); Proxy proxy = new Proxy(); proxy.setProxyType(Proxy.ProxyType.MANUAL) .setHttpProxy(proxyString) .setFtpProxy(proxyString) .setSslProxy(proxyString); return proxy; }
public Proxy getProxy() { Proxy proxy = null; if (proxyHost != null) { proxy = new Proxy(); proxy.setProxyType(ProxyType.MANUAL); proxy.setHttpProxy(proxyHost); proxy.setFtpProxy(proxyHost); proxy.setSslProxy(proxyHost); } return proxy; }
proxy.setFtpProxy(proxyFtp);
proxy.setFtpProxy(proxyFtp);
if (proxyProperty != null) { Proxy proxy = new Proxy(); proxy.setHttpProxy(proxyProperty).setFtpProxy(proxyProperty).setSslProxy( proxyProperty); desiredCapabilities = new DesiredCapabilities();
if (proxyProperty != null) { Proxy proxy = new Proxy(); proxy.setHttpProxy(proxyProperty).setFtpProxy(proxyProperty).setSslProxy( proxyProperty); desiredCapabilities = new DesiredCapabilities();
/** * Creates the DesiredCapabilities for an IE WebDriver. * @param proxyUrl * @return DesiredCapabilities */ protected static DesiredCapabilities createCapabilitiesIE(String proxyUrl) { DesiredCapabilities cap = DesiredCapabilities.internetExplorer(); cap.setCapability(CapabilityType.LOGGING_PREFS, createLoggingPreferences()); cap.setCapability("ignoreProtectedModeSettings", true); cap.setCapability("ignoreZoomSetting", true); if (StringUtils.isNotEmpty(proxyUrl)) { Proxy proxy = new Proxy(); proxy.setHttpProxy(proxyUrl).setFtpProxy(proxyUrl).setSslProxy(proxyUrl).setNoProxy(""); cap.setCapability(CapabilityType.PROXY, proxy); } return cap; }
/** * Creates the DesiredCapabilities for firefox. * @param proxyUrl * @param profile * @return DesiredCapabilities */ protected static DesiredCapabilities createCapabilitesFirefox(String proxyUrl, FirefoxProfile profile) { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); if (!proxyUrl.isEmpty()) { capabilities.setCapability(FirefoxDriver.PROFILE, profile); profile.setPreference("network.proxy.type", 1); Proxy proxy = new Proxy(); proxy.setHttpProxy(proxyUrl).setFtpProxy(proxyUrl).setSslProxy(proxyUrl).setNoProxy(""); capabilities.setCapability(CapabilityType.PROXY, proxy); } capabilities.setCapability(CapabilityType.LOGGING_PREFS, createLoggingPreferences()); return capabilities; }
proxy.setHttpProxy(PROXY).setFtpProxy(PROXY).setSslProxy(PROXY).setSocksProxy(PROXY); cap.setCapability(CapabilityType.PROXY, proxy);
/** * Create new Proxy from driver options. * * @param driverOptions driver options. * @return Proxy or null. */ public static Proxy newProxy(DriverOptions driverOptions) { if (!driverOptions.has(PROXY)) return null; Proxy proxy = new Proxy(); proxy.setProxyType(ProxyType.MANUAL); String ps = driverOptions.get(PROXY); proxy.setHttpProxy(ps) .setSslProxy(ps) .setFtpProxy(ps); if (driverOptions.has(NO_PROXY)) proxy.setNoProxy(driverOptions.get(NO_PROXY)); return proxy; }
/** * This returns a {@link Proxy} with HTTP, HTTPS and FTP hosts and ports configured as specified. * * * @param httpProxy is the http proxy host and port * @param httpsProxy is the https proxy host and port * @param ftpProxy is the ftp proxy host and port * @param socksProxy is the socks proxy host and port * @param noProxy is a comma separated list of hosts that will bypass the proxy * * @return a proxy object with the hosts manually specified. */ public Proxy getManualProxy(ProxyHostPort httpProxy, ProxyHostPort httpsProxy, ProxyHostPort ftpProxy, ProxyHostPort socksProxy, String noProxy) { return new Proxy() .setProxyType(Proxy.ProxyType.MANUAL) .setHttpProxy(httpProxy.toUnifiedForm()) .setSslProxy(httpsProxy.toUnifiedForm()) .setFtpProxy(ftpProxy.toUnifiedForm()) .setSocksProxy(socksProxy.toUnifiedForm()) .setNoProxy(noProxy); }
proxy.setFtpProxy(wdProxy).setHttpProxy(wdProxy).setSslProxy(wdProxy); options.setCapability(PROXY, proxy);
proxy.setFtpProxy(wdProxy).setHttpProxy(wdProxy).setSslProxy(wdProxy); options.setCapability(PROXY, proxy);
public Proxy getProxy() { ProxyConfig proxyConfig = getProxyConfig(); Proxy proxy = new Proxy(); proxy.setProxyType(proxyConfig.getType()); if (proxyConfig.getType() == ProxyType.PAC) { proxy.setProxyAutoconfigUrl(proxyConfig.getPac()); // manual proxy configuration } else if (proxyConfig.getType() == ProxyType.MANUAL) { proxy.setHttpProxy(proxyConfig.getAddressAndPort()); proxy.setSslProxy(proxyConfig.getAddressAndPort()); proxy.setFtpProxy(proxyConfig.getAddressAndPort()); if (proxyConfig.getLogin() != null && proxyConfig.getPassword() != null) { proxy.setSocksUsername(proxyConfig.getLogin()); proxy.setSocksPassword(proxyConfig.getPassword()); } if (proxyConfig.getExclude() != null) { proxy.setNoProxy(proxyConfig.getExclude().replace(";", ",")); } } return proxy; }