org.openqa.selenium.Proxy.setSocksPassword()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.openqa.selenium.Proxy.setSocksPassword()方法的一些代码示例,展示了Proxy.setSocksPassword()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Proxy.setSocksPassword()方法的具体详情如下:
包路径:org.openqa.selenium.Proxy
类名称:Proxy
方法名:setSocksPassword

Proxy.setSocksPassword介绍

[英]Specifies a password for the SOCKS proxy. Supported by SOCKS v5 and above.
[中]指定SOCKS代理的密码。由SOCKS v5及以上版本支持。

代码示例

代码示例来源:origin: org.seleniumhq.selenium/selenium-api

setSocksPassword((String) raw.get("socksPassword"));

代码示例来源: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;
}

相关文章