本文整理了Java中org.openqa.selenium.Proxy.getHttpProxy()
方法的一些代码示例,展示了Proxy.getHttpProxy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Proxy.getHttpProxy()
方法的具体详情如下:
包路径:org.openqa.selenium.Proxy
类名称:Proxy
方法名:getHttpProxy
[英]Gets the HTTP proxy.
[中]
代码示例来源:origin: selenide/selenide
static InetSocketAddress getProxyAddress(Proxy proxy) {
String httpProxy = proxy.getHttpProxy();
String host = httpProxy.replaceFirst("(.*):.*", "$1");
String port = httpProxy.replaceFirst(".*:(.*)", "$1");
return new InetSocketAddress(host, parseInt(port));
}
代码示例来源:origin: detro/ghostdriver
switch (proxy.getProxyType()) {
case MANUAL:
if (proxy.getHttpProxy() != null && !proxy.getHttpProxy().isEmpty()) { //< HTTP proxy
argsBuilder.add("--proxy-type=http");
argsBuilder.add(String.format("--proxy=%s", proxy.getHttpProxy()));
} else if (proxy.getSocksProxy() != null && !proxy.getSocksProxy().isEmpty()) { //< SOCKS5 proxy
argsBuilder.add("--proxy-type=socks5");
代码示例来源:origin: sayems/java.webdriver
default List<String> applyPhantomJSProxySettings(List<String> cliArguments, Proxy proxySettings) {
if (null == proxySettings) {
cliArguments.add("--proxy-type=none");
} else {
cliArguments.add("--proxy-type=http");
cliArguments.add("--proxy=" + proxySettings.getHttpProxy());
}
return cliArguments;
}
}
代码示例来源:origin: com.machinepublishers/jbrowserdriver
Settings build(Capabilities capabilities) {
Map properties = new HashMap(capabilities.asMap());
Proxy proxy = Proxy.extractFrom(capabilities);
if (proxy != null) {
String proxyConfigString = proxy.getHttpProxy();
if (proxyConfigString != null) {
Pattern pattern = Pattern.compile("(?:http(?:s)?:\\/\\/)?(?:([^:@]*):([^:@]*)@)?([^:@]*)(?::(\\d+))?");
Matcher matcher = pattern.matcher(proxyConfigString);
if (matcher.matches()) {
properties.put(PropertyName.PROXY_TYPE.propertyName, ProxyConfig.Type.HTTP);
properties.put(PropertyName.PROXY_USERNAME.propertyName, matcher.group(1));
properties.put(PropertyName.PROXY_PASSWORD.propertyName, matcher.group(2));
properties.put(PropertyName.PROXY_HOST.propertyName, matcher.group(3));
properties.put(PropertyName.PROXY_PORT.propertyName, matcher.group(4));
}
}
}
for (Map.Entry entry : System.getProperties().entrySet()) {
properties.put(entry.getKey(), entry.getValue());
}
return new Settings(this, properties);
}
}
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
builder.append(", ftp=").append(p);
p = getHttpProxy();
if (p != null) {
builder.append(", http=").append(p);
代码示例来源:origin: org.seleniumhq.selenium/selenium-htmlunit-driver
String httpProxy = proxy.getHttpProxy();
if (httpProxy != null && !httpProxy.equals("")) {
String host = httpProxy;
代码示例来源:origin: com.codeborne/phantomjsdriver
switch (proxy.getProxyType()) {
case MANUAL:
if (proxy.getHttpProxy() != null && !proxy.getHttpProxy().isEmpty()) { //< HTTP proxy
argsBuilder.add("--proxy-type=http");
argsBuilder.add(String.format("--proxy=%s", proxy.getHttpProxy()));
} else if (proxy.getSocksProxy() != null && !proxy.getSocksProxy().isEmpty()) { //< SOCKS5 proxy
argsBuilder.add("--proxy-type=socks5");
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Proxy proxy = (Proxy) o;
return isAutodetect() == proxy.isAutodetect() &&
getProxyType() == proxy.getProxyType() &&
Objects.equals(getFtpProxy(), proxy.getFtpProxy()) &&
Objects.equals(getHttpProxy(), proxy.getHttpProxy()) &&
Objects.equals(getNoProxy(), proxy.getNoProxy()) &&
Objects.equals(getSslProxy(), proxy.getSslProxy()) &&
Objects.equals(getSocksProxy(), proxy.getSocksProxy()) &&
Objects.equals(getSocksVersion(), proxy.getSocksVersion()) &&
Objects.equals(getSocksUsername(), proxy.getSocksUsername()) &&
Objects.equals(getSocksPassword(), proxy.getSocksPassword()) &&
Objects.equals(getProxyAutoconfigUrl(), proxy.getProxyAutoconfigUrl());
}
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
@Override
public int hashCode() {
return Objects.hash(
getProxyType(),
isAutodetect(),
getFtpProxy(),
getHttpProxy(),
getNoProxy(),
getSslProxy(),
getSocksProxy(),
getSocksVersion(),
getSocksUsername(),
getSocksPassword(),
getProxyAutoconfigUrl());
}
}
代码示例来源:origin: com.opera/operadriver
if (proxy.getHttpProxy() != null) {
setHttpProxy(proxy.getHttpProxy());
内容来源于网络,如有侵权,请联系作者删除!