本文整理了Java中org.openqa.selenium.Proxy.setNoProxy()
方法的一些代码示例,展示了Proxy.setNoProxy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Proxy.setNoProxy()
方法的具体详情如下:
包路径:org.openqa.selenium.Proxy
类名称:Proxy
方法名:setNoProxy
[英]Sets proxy bypass (noproxy) addresses
[中]设置代理绕过(noproxy)地址
代码示例来源:origin: stackoverflow.com
Proxy proxy=startProxy();
proxy.setProxyType(ProxyType.MANUAL);
proxy.setNoProxy("");
ChromeOptions options = new ChromeOptions();
DesiredCapabilities dc = DesiredCapabilities.chrome();
dc.setCapability(CapabilityType.PROXY, proxy);
System.setProperty("webdriver.chrome.driver",sChromeDriverPath);
dc.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(dc);
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
if (rawData instanceof List) {
setNoProxy(String.join(", ", (List) rawData));
} else {
setNoProxy((String) rawData);
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
/**
* @Title: browserProxySettings @Description: TODO @author
* alterhu2020@gmail.com @param @param capability @param @param
* proxysettings @return void return type @throws
*/
public static void ProxySettings(DesiredCapabilities capability, String proxysettings) {
org.openqa.selenium.Proxy httpproxy = new org.openqa.selenium.Proxy();
httpproxy.setHttpProxy(proxysettings);
httpproxy.setSslProxy(proxysettings);
httpproxy.setNoProxy("localhost");
capability.setCapability(CapabilityType.PROXY, httpproxy);
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: browserProxySettings @Description: TODO @author
* alterhu2020@gmail.com @param @param capability @param @param
* proxysettings @return void return type @throws
*/
public static void ProxySettings(DesiredCapabilities capability, String proxysettings) {
org.openqa.selenium.Proxy httpproxy = new org.openqa.selenium.Proxy();
httpproxy.setHttpProxy(proxysettings);
httpproxy.setSslProxy(proxysettings);
httpproxy.setNoProxy("localhost");
capability.setCapability(CapabilityType.PROXY, httpproxy);
}
代码示例来源:origin: org.unitils.selenium/unitils-selenium
/**
* 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;
}
代码示例来源:origin: org.unitils.selenium/unitils-selenium
/**
* 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;
}
代码示例来源:origin: vmi/selenese-runner-java
/**
* 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;
}
代码示例来源:origin: kg.apc/jmeter-plugins-webdriver
/**
* 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);
}
代码示例来源:origin: com.infotel.seleniumRobot/core
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;
}
内容来源于网络,如有侵权,请联系作者删除!