本文整理了Java中org.openqa.selenium.Proxy.setSocksUsername()
方法的一些代码示例,展示了Proxy.setSocksUsername()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Proxy.setSocksUsername()
方法的具体详情如下:
包路径:org.openqa.selenium.Proxy
类名称:Proxy
方法名:setSocksUsername
[英]Specifies a username for the SOCKS proxy. Supported by SOCKS v5 and above.
[中]指定SOCKS代理的用户名。由SOCKS v5及以上版本支持。
代码示例来源:origin: org.seleniumhq.selenium/selenium-api
setSocksUsername((String) raw.get("socksUsername"));
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!